Evernote / evernote-sdk-android

Evernote SDK for Android
428 stars 168 forks source link

logout: Null Pointer Exception #24

Closed osanwe closed 11 years ago

osanwe commented 11 years ago

I wrote follow code: public class MainActivity extends ParentActivity implements OnClickListener { private static final String TAG = "MainActivity";

    private Button loginButton;

    @Override
    public void onClick(View view) {
        mEvernoteSession.logOut(this);
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        loginButton = (Button)findViewById(R.id.login_button);

        loginButton.setOnClickListener(this);
    }
}

and looked follow exception: 03-13 22:37:54.810: E/AndroidRuntime(9934): FATAL EXCEPTION: main 03-13 22:37:54.810: E/AndroidRuntime(9934): java.lang.NullPointerException 03-13 22:37:54.810: E/AndroidRuntime(9934): at com.evernote.client.android.EvernoteSession.logOut(EvernoteSession.java:360) 03-13 22:37:54.810: E/AndroidRuntime(9934): at ru.dcosanve.everlistforandroid.MainActivity.onClick(MainActivity.java:20) 03-13 22:37:54.810: E/AndroidRuntime(9934): at android.view.View.performClick(View.java:3526) 03-13 22:37:54.810: E/AndroidRuntime(9934): at android.view.View$PerformClick.run(View.java:14133) 03-13 22:37:54.810: E/AndroidRuntime(9934): at android.os.Handler.handleCallback(Handler.java:605) 03-13 22:37:54.810: E/AndroidRuntime(9934): at android.os.Handler.dispatchMessage(Handler.java:92) 03-13 22:37:54.810: E/AndroidRuntime(9934): at android.os.Looper.loop(Looper.java:137) 03-13 22:37:54.810: E/AndroidRuntime(9934): at android.app.ActivityThread.main(ActivityThread.java:4697) 03-13 22:37:54.810: E/AndroidRuntime(9934): at java.lang.reflect.Method.invokeNative(Native Method) 03-13 22:37:54.810: E/AndroidRuntime(9934): at java.lang.reflect.Method.invoke(Method.java:511) 03-13 22:37:54.810: E/AndroidRuntime(9934): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787) 03-13 22:37:54.810: E/AndroidRuntime(9934): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554) 03-13 22:37:54.810: E/AndroidRuntime(9934): at dalvik.system.NativeStart.main(Native Method) I think your want to validate field mAuthenticationResult before using.

tyvsmith commented 11 years ago

Thanks, I'll add this.