Pixplicity / gene-rate

Generate a better rating for your Android app
Apache License 2.0
67 stars 17 forks source link

Exception on clicking rate button #22

Closed jaibatrik closed 5 years ago

jaibatrik commented 5 years ago

I'm getting the below Exception when users try to rate -

Fatal Exception: java.lang.NullPointerException: Attempt to invoke interface method 'void com.pixplicity.generate.OnFeedbackListener.onRateTapped()' on a null object reference at com.pixplicity.generate.Rate$2.onClick(Rate.java:304) at android.view.View.performClick(View.java:6261) at android.widget.TextView.performClick(TextView.java:11185) at android.view.View$PerformClick.run(View.java:23752) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6776) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1518) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)

Below is the related code -

     Rate rate = new Rate.Builder(this)
                .setSnackBarParent(findViewById(R.id.activity_container))
                .setMessage(R.string.rating_persuasion)
                .build();

        rate.count();
        rate.showRequest();
jaibatrik commented 5 years ago

Rate.java needs null checks around usages of mFeedbackAction or mFeedbackAction needs to be initialized with no-op methods.

adndestroy commented 5 years ago

Rate rate = new Rate.Builder(this) .setSnackBarParent(findViewById(R.id.activity_container)) .setMessage(R.string.rating_persuasion) .build(); rate.count(); rate.showRequest();

pflammertsma commented 5 years ago

This is indeed a bug; if no feedback URL is provided, pressing the feedback button will throw a NullPointerException.

A proper solution would be to conceal the feedback dialog if no URL is provided, but for now I'll simply wrap all invocations of mFeedbackAction in null checks.

pflammertsma commented 5 years ago

Disregard my previous remark about the feedback button displaying; that isn't the case. The issue here is only that an uninitialized mFeedbackAction is invoked when the user presses the rate button.

adndestroy commented 5 years ago

Provenance : Courrierhttps://go.microsoft.com/fwlink/?LinkId=550986 pour Windows 10

De : Paul Lammertsmamailto:notifications@github.com Envoyé le :mardi 23 octobre 2018 23:09 À : Pixplicity/gene-ratemailto:gene-rate@noreply.github.com Cc : Muno Christophemailto:christ2904@outlook.com; Commentmailto:comment@noreply.github.com Objet :Re: [Pixplicity/gene-rate] Exception on clicking rate button (#22)

Disregard my previous remark about the feedback button displaying; that isn't the case. The issue here is only that an uninitialized mFeedbackAction is invoked when the user presses the rate button.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/Pixplicity/gene-rate/issues/22#issuecomment-432420678, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AjGWm4dc0Q6PnAuQGmcnjhJ1BtcVQOEGks5un4WDgaJpZM4XaFj1. Excuse me i have little problem my English it’s not very good , i don’t understand your mail i just speak french I am very disapointed

pflammertsma commented 5 years ago

I have submitted a pull request to resolve this. Hopefully a peer can review this soon and deploy a fix.