PeterStaev / NativeScript-Drop-Down

A NativeScript DropDown widget.
Apache License 2.0
105 stars 65 forks source link

Dropdowns on Modals cause an uncaught Exception during Pause event #181

Closed Psionyx closed 6 years ago

Psionyx commented 6 years ago

We have an application where the user brings up a modal to make additional choices. We are using dropdowns for the workflow. It was discovered though that by closing the device/tablet with a modal open during the pause event we get the attached exception. This doesn't happen on a normal page. Only when using the dropdown on a modal and only when that dropdown is open

System.err: com.tns.NativeScriptException:
System.err: Calling js method getCount failed
System.err:
System.err: TypeError: Cannot read property 'get' of null
System.err: File: "file:///data/data/com.directsupply.dssmart/files/app/tns_modules/nativescript-drop-down/drop-down.js, line: 236, column: 35
System.err:
System.err: StackTrace:
System.err:     Frame: function:'DropDownAdapterImpl.getCount', file:'file:///data/data/com.directsupply.dssmart/files/app/tns_modules/nativescript-drop-down/drop-down.js', line: 236, column: 36
System.err:
System.err:     at com.tns.Runtime.callJSMethodNative(Native Method)
System.err:     at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1101)
System.err:     at com.tns.Runtime.callJSMethodImpl(Runtime.java:983)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:970)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:954)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:946)
System.err:     at com.tns.gen.android.widget.BaseAdapter_down_228_32_DropDownAdapterImpl.getCount(BaseAdapter_down_228_32_DropDownAdapterImpl.java:22)
System.err:     at android.widget.Spinner$DropDownAdapter.getCount(Spinner.java:1096)
System.err:     at android.widget.ListView.onMeasure(ListView.java:1261)
System.err:     at android.view.View.measure(View.java:21289)
System.err:     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6443)
System.err:     at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
System.err:     at android.view.View.measure(View.java:21289)
System.err:     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6443)
System.err:     at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
System.err:     at android.view.View.measure(View.java:21289)
System.err:     at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2642)
System.err:     at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1695)
System.err:     at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1950)
System.err:     at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1567)
System.err:     at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7282)
System.err:     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:930)
System.err:     at android.view.Choreographer.doCallbacks(Choreographer.java:705)
System.err:     at android.view.Choreographer.doFrame(Choreographer.java:640)
System.err:     at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:916)
System.err:     at android.os.Handler.handleCallback(Handler.java:751)
System.err:     at android.os.Handler.dispatchMessage(Handler.java:95)
System.err:     at android.os.Looper.loop(Looper.java:154)
System.err:     at android.app.ActivityThread.main(ActivityThread.java:6823)
System.err:     at java.lang.reflect.Method.invoke(Native Method)
System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1557)
System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445)
JS: NativeScriptError: Error: The application crashed because of an uncaught exception. You can look at "stackTrace" or "nativeException" for more detailed information about the exception.
PeterStaev commented 6 years ago

Hey @Psionyx , this is a really strange error. I've added some checks that should avoid triggering the error. Please try the new version on npm and let me know if you still have problems.