NPE on blur if no card number entered
biddster opened this issue · 11 comments
I have the credit card setup to be blank so a user can input a new card. If I click in the credit card field and then click out without entering a number, I get this exception:
java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
at com.vinaygaba.creditcardview.CreditCardView$2.onFocusChange(CreditCardView.java:215)
at android.view.View.onFocusChanged(View.java:5206)
at android.widget.TextView.onFocusChanged(TextView.java:7913)
at android.view.View.clearFocusInternal(View.java:5089)
at android.view.View.unFocus(View.java:5122)
at android.view.ViewGroup.requestChildFocus(ViewGroup.java:658)
at android.view.View.handleFocusGainInternal(View.java:4955)
at android.view.View.requestFocusNoSearch(View.java:7678)
at android.view.View.requestFocus(View.java:7657)
at android.view.View.requestFocus(View.java:7624)
at android.view.View.requestFocus(View.java:7603)
at android.view.View.onTouchEvent(View.java:9439)
at android.widget.TextView.onTouchEvent(TextView.java:7965)
at android.view.View.dispatchTouchEvent(View.java:8471)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2106)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2106)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2106)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2106)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2106)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2106)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2106)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2106)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2106)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2106)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2369)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1719)
at android.app.Activity.dispatchTouchEvent(Activity.java:2742)
at android.support.v7.internal.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:59)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2330)
at android.view.View.dispatchPointerEvent(View.java:8666)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4123)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3989)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3544)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3597)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3563)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3680)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3571)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3737)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3544)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3597)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3563)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3571)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3544)
at android.view.ViewRootImpl.deliverInputEvent(Vi
Hi,
I have identified what's causing the bug and will be fixing it later today! Appreciate you pointing this out. Thanks!
Pleasure, thanks for the fast response.
Hi,
Could you be a bit more detailed with the steps that caused this error. I was trying to replicate it but clicking on the filed, not entering any value and clicking out without entering a number did not result in an NPE. I might be missing some step.
Also, which version of the library are you using?
@biddster Just wanted to confirm if you are still seeing this issue in v1.0.2 of the library after you cleared the cache?
Hi @biddster,
Closing this issue as I am not able to replicate it. If this issue persists for you, could you please reply to my queries above so that I can fix it asap :)
Apologies for not getting back to you sooner. I'm on holiday and only
infrequently get a data connection. I'm back in the office on Wednesday and
will try to provide more information.
On Fri, 26 Jun 2015 19:30 Vinay Gaba notifications@github.com wrote:
Hi @biddster https://github.com/biddster,
Closing this issue as I am not able to replicate it. If this issue
persists for you, could you please reply to my queries above so that I can
fix it asap :)—
Reply to this email directly or view it on GitHub
#6 (comment)
.
Brilliant, many thanks.
On Tue, 30 Jun 2015 07:35 Vinay Gaba notifications@github.com wrote:
@biddster https://github.com/biddster I was able to reproduce this and
have fixed it!—
Reply to this email directly or view it on GitHub
#6 (comment)
.
Confirming fixed in 1.0.3.