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

้hey guy i error codeing spotsDialog java.lang.NullPointerException: #20

Closed
PongPloy2016 opened this issue Jan 13, 2017 · 3 comments
Closed

Comments

@PongPloy2016
Copy link

I catch error progressbar

if (spotsDialog != null) {

                spotsDialog.dismiss();
                spotsDialog = null;
            } else {
                spotsDialog.dismiss();
                spotsDialog = null;
            }

and show logcaat

Process: th.co.siamkubota.kubota, PID: 24287
java.lang.NullPointerException: Attempt to invoke virtual method 'void dmax.dialog.SpotsDialog.dismiss()' on a null object reference
at th.co.siamkubota.kubota.fragment.UnfinishTaskFragment$1.onPostExecute(UnfinishTaskFragment.java:308)
at th.co.siamkubota.kubota.fragment.UnfinishTaskFragment$1.onPostExecute(UnfinishTaskFragment.java:221)
at android.os.AsyncTask.finish(AsyncTask.java:636)
at android.os.AsyncTask.access$500(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:653)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6856)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)

@dybarsky
Copy link
Owner

dybarsky commented Mar 7, 2017

Hi! You have a wrong logic. I believe else block is unnecessary :)

@dybarsky dybarsky closed this as completed Mar 7, 2017
@matloobn73
Copy link

matloobn73 commented Sep 27, 2018

If (spotsDialog != Null){
//If spotsDialog is not null.
spotsDialog.dismiss;
spotsDialog = null;
}else{
//If spotsDialog is null.
//You can't do anything with spotsDialog as it is null.
//You don't have to call spotsDialog.dismiss as it is already null and hence dismissed.
}

@PongPloy2016
Copy link
Author

PongPloy2016 commented Sep 30, 2018

If (spotsDialog != Null){
//If spotsDialog is not null.
spotsDialog.dismiss;
spotsDialog = null;
}else{
//If spotsDialog is null.
//You can't do anything with spotsDialog as it is null.
//You don't have to call spotsDialog.dismiss as it is already null and hence dismissed.
}

thank you bro i check null
If (spotsDialog != Null){
.....
}

and run project and show catch error In perhaps : Attempt to invoke virtual method 'void dmax.dialog.SpotsDialog.dismiss()' on a null object reference to some time

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

3 participants