Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal Exception: java.lang.NullPointerException #213

Open
AliTaylor1 opened this issue Feb 16, 2018 · 3 comments
Open

Fatal Exception: java.lang.NullPointerException #213

AliTaylor1 opened this issue Feb 16, 2018 · 3 comments

Comments

@AliTaylor1
Copy link

I'm really struggling to recreate this validation issue where some somehow the ValidatorContext losses context.
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.mobsandgeeks.saripaar.ValidationContext.setViewRulesMap(java.util.Map)' on a null object reference
at com.mobsandgeeks.saripaar.Validator.createRulesSafelyAndLazily(Validator.java:479)

@traitaodoc1994
Copy link

have you solved it?

@xionger0520
Copy link

@AliTaylor1 @traitaodoc1994 @ragunathjawahar can you tell me how to solve it? I had the same problem.

@Puneet1796
Copy link

Puneet1796 commented Jun 2, 2020

Hey,
I found the solution around this. Compare your validator initialization with the bottom code snippet.
Validator validator = new Validator(this);
Always pass this as its controller reference. If you're trying to pass getContext()/requireContext() or getActivity()/requireActivity() then somehow It won't be able to figure out on which class you are try to associate your validator.

I hope it helps. Happy Coding! </>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants