-
Notifications
You must be signed in to change notification settings - Fork 50
Description
2023-03-28 10:49:13.024 24616-24616/com.carlosvicente.uberkotlin E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.carlosvicente.uberkotlin, PID: 24616
java.lang.NullPointerException: Attempt to read from field 'double com.google.android.gms.maps.model.LatLng.latitude' on a null object reference
at com.example.easywaylocation.draw_path.RouteEvaluator.evaluate(RouteEvaluator.java:11)
at com.example.easywaylocation.draw_path.RouteEvaluator.evaluate(RouteEvaluator.java:8)
at android.animation.KeyframeSet.getValue(KeyframeSet.java:202)
at android.animation.PropertyValuesHolder.calculateValue(PropertyValuesHolder.java:1017)
at android.animation.ValueAnimator.animateValue(ValueAnimator.java:1561)
at android.animation.ObjectAnimator.animateValue(ObjectAnimator.java:987)
at android.animation.ValueAnimator.setCurrentFraction(ValueAnimator.java:692)
at android.animation.ValueAnimator.start(ValueAnimator.java:1089)
at android.animation.ValueAnimator.start(ValueAnimator.java:1106)
at android.animation.ObjectAnimator.start(ObjectAnimator.java:852)
at android.animation.ValueAnimator.startWithoutPulsing(ValueAnimator.java:1099)
at android.animation.AnimatorSet.handleAnimationEvents(AnimatorSet.java:1149)
at android.animation.AnimatorSet.doAnimationFrame(AnimatorSet.java:1053)
at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:146)
at android.animation.AnimationHandler.access$100(AnimationHandler.java:37)
at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:54)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1035)
at android.view.Choreographer.doCallbacks(Choreographer.java:845)
at android.view.Choreographer.doFrame(Choreographer.java:775)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1022)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7839)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
Additional context
private fun easyDrawRoute() {
if (originLatLng != null && destinationLatLng != null && originLatLng!!.latitude != 0.0 && originLatLng!!.longitude != 0.0 && destinationLatLng!!.latitude != 0.0 && destinationLatLng!!.longitude != 0.0) {
wayPoints.add(originLatLng!!)
Log.d("PLACESTRIP", "easyDrawRoute:$destinationLatLng Y ${destinationLatLng!!.latitude} ")
Log.d("PLACESTRIP", "wayPoints:$wayPoints Y $googleMap ")
wayPoints.add(destinationLatLng!!)
directionUtil = DirectionUtil.Builder()
.setDirectionKey(resources.getString(R.string.google_maps_key))
.setOrigin(originLatLng!!)
.setWayPoints(wayPoints)
.setGoogleMap(googleMap!!)
.setPolyLinePrimaryColor(R.color.green)
.setPolyLineWidth(15)
.setPathAnimation(true)
.setCallback(this)
.setDestination(destinationLatLng!!)
.build()
directionUtil.initPath()
}
}