dapriett / nativescript-google-maps-sdk

Cross Platform Google Maps SDK for Nativescript
MIT License
244 stars 164 forks source link

Cannot read property 'forEach' of undefined on function removeAllShapes #386

Closed RealZimboGuy closed 4 years ago

RealZimboGuy commented 4 years ago

This error dosnt always occur, a semi way of reproducing is a map object and then pressing back to close the android app where the function is called.

i assume its from this function in the code this._shapes.forEach(shape => { shape.android.remove(); }); this._shapes = [];

where the _shapes object is undefined.

here is the stack,

An uncaught Exception occurred on "main" thread. Calling js method run failed TypeError: Cannot read property 'forEach' of undefined

StackTrace: push.../node_modules/nativescript-google-maps-sdk/map-view.js.MapView.removeAllShapes(file:///data/data/com.test.testapp/files/app/vendor.js:152238:22) at (file:///data/data/com.test.testapp/files/app/0.js:465:31) at push.../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.__tryOrUnsub(file:///data/data/com.test.testapp/files/app/vendor.js:162543:16) at push.../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.next(file:///data/data/com.test.testapp/files/app/vendor.js:162481:22) at push.../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._next(file:///data/data/com.test.testapp/files/app/vendor.js:162427:26) at push.../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next(file:///data/data/com.test.testapp/files/app/vendor.js:162404:18) at push.../node_modules/rxjs/_esm5/internal/Subject.js.Subject.next(file:///data/data/com.test.testapp/files/app/vendor.js:162178:25) at push.../node_modules/rxjs/_esm5/internal/ReplaySubject.js.ReplaySubject.nextInfiniteTimeWindow(file:///data/data/com.test.testapp/files/app/vendor.js:162005:31) at module.exports.push../app/sidenav-history/sidenav-history.component.ts.SidenavHistoryComponent.ngOnDestroy(file:///data/data/com.test.testapp/files/app/bundle.js:1019:43) at callProviderLifecycles(file:///data/data/com.test.testapp/files/app/vendor.js:59528:18) at callElementProvidersLifecycles(file:///data/data/com.test.testapp/files/app/vendor.js:59496:13) at callLifecycleHooksChildrenFirst(file:///data/data/com.test.testapp/files/app/vendor.js:59486:29) at destroyView(file:///data/data/com.test.testapp/files/app/vendor.js:67682:5) at callViewAction(file:///data/data/com.test.testapp/files/app/vendor.js:67808:13) at execEmbeddedViewsAction(file:///data/data/com.test.testapp/files/app/vendor.js:67751:17) at destroyView(file:///data/data/com.test.testapp/files/app/vendor.js:67680:5) at callViewAction(file:///data/data/com.test.testapp/files/app/vendor.js:67808:13) at execEmbeddedViewsAction(file:///data/data/com.test.testapp/files/app/vendor.js:67751:17) at destroyView(file:///data/data/com.test.testapp/files/app/vendor.js:67680:5) at callViewAction(file:///data/data/com.test.testapp/files/app/vendor.js:67808:13) at execComponentViewsAction(file:///data/data/com.test.testapp/files/app/vendor.js:67730:13) at destroyView(file:///data/data/com.test.testapp/files/app/vendor.js:67681:5) at callWithDebugContext(file:///data/data/com.test.testapp/files/app/vendor.js:68417:25) at debugDestroyView(file:///data/data/com.test.testapp/files/app/vendor.js:68125:12) at push.../nodemodules/@angular/core/fesm5/core.js.ViewRef.destroy(file:///data/data/com.test.testapp/files/app/vendor.js:58817:18) at (file:///data/data/com.test.testapp/files/app/vendor.js:65285:67) at push.../node_modules/@angular/core/fesm5/core.js.ApplicationRef.ngOnDestroy(file:///data/data/com.test.testapp/files/app/vendor.js:65285:29) at callNgModuleLifecycle(file:///data/data/com.test.testapp/files/app/vendor.js:58429:31) at push.../nodemodules/@angular/core/fesm5/core.js.NgModuleRef.destroy(file:///data/data/com.test.testapp/files/app/vendor.js:59030:9) at (file:///data/data/com.test.testapp/files/app/vendor.js:86959:31) at push.../node_modules/@nativescript/core/data/observable/observable.js.Observable.notify(file:///data/data/com.test.testapp/files/app/vendor.js:94930:23) at push.../node_modules/@nativescript/core/ui/frame/frame.js.ActivityCallbacksImplementation.onDestroy(file:///data/data/com.test.testapp/files/app/vendor.js:114240:25) at push.../node_modules/@nativescript/core/ui/frame/activity.js.NativeScriptActivity.onDestroy(file:///data/data/com.test.testapp/files/app/vendor.js:111985:25) at com.tns.Runtime.callJSMethodNative(Native Method) at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1286) at com.tns.Runtime.callJSMethodImpl(Runtime.java:1173) at com.tns.Runtime.callJSMethod(Runtime.java:1160) at com.tns.Runtime.callJSMethod(Runtime.java:1138) at com.tns.Runtime.callJSMethod(Runtime.java:1134) at com.tns.gen.java.lang.Runnable.run(Runnable.java:17) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7356) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

TwistedTamarin commented 4 years ago

Should be fixed in my PR: 395

fgutteridge commented 4 years ago

@dapriett I’ve confirmed that this issue is indeed fixed thanks to @TwistedTamarin’s PR. Are you able to close this? Thanks!

dapriett commented 4 years ago

Thanks @TwistedTamarin!