juliocbcotta
12/03/2024, 9:58 AMCaused by java.lang.NullPointerException:
at com.veepee.pickuppoint.ui.PickUpPointActivity.parameter_delegate$lambda$2(PickUpPointActivity.java:596)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at com.veepee.pickuppoint.ui.PickUpPointActivity.parameter_delegate$lambda$2(PickUpPointActivity.kt:114)
at com.veepee.pickuppoint.ui.PickUpPointActivity.getParameter(PickUpPointActivity.kt:114)
at com.veepee.pickuppoint.ui.PickUpPointActivity.onCreate(PickUpPointActivity.kt:176)
at android.app.Activity.performCreate(Activity.java:8305)
at android.app.Activity.performCreate(Activity.java:8284)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1417)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3626)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3782)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2307)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7872)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
this is my code
private val parameter by lazy { requireLinkParameter<PickUpPointActivityParameter>() }
...
override fun onCreate(savedInstanceState: Bundle?) {
if (parameter.shouldDoSomething) {
// do something
}
requireLinkParameter
just reads an Intent
Parcelable, but the error is not saying that the Parcelable is null or anything. Any idea of what can be happening ?Gaurav Gupta
12/04/2024, 5:13 PMjuliocbcotta
12/05/2024, 3:26 PMjuliocbcotta
12/05/2024, 3:30 PMGaurav Gupta
12/06/2024, 8:03 PMjuliocbcotta
12/09/2024, 1:17 PMjuliocbcotta
12/23/2024, 10:23 AMCaused by java.lang.NullPointerException:
at com.veepee.vpcore.route.BundleExtensionsKt.getLinkParameter(BundleExtensions.kt:41)
at com.venteprivee.features.home.ui.HomesActivity.onCreate(HomesActivity.kt:123)
at android.app.Activity.performCreate(Activity.java:8071)
This is odd, my code is doing
intent.requireLinkParameter<HomesActivityParameter>()
that does this
inline fun <reified T : ParcelableParameter> Intent.requireLinkParameter(): T {
return getLinkParameter()!!
}
inline fun <reified T : ParcelableParameter> Intent.getLinkParameter(): T? {
return IntentCompat.getParcelableExtra(this, LINK_PARAMETER, T::class.java)
}
from the decompiled code I found this
Intent $this$requireLinkParameter$iv = this.getIntent();
Intrinsics.checkNotNullExpressionValue($this$requireLinkParameter$iv, "getIntent(...)");
$this$requireLinkParameter$iv = $this$requireLinkParameter$iv;
int $i$f$requireLinkParameter = false;
Intent $this$getLinkParameter$iv$iv = $this$requireLinkParameter$iv;
int $i$f$getLinkParameter = false;
Intrinsics.checkNotNull((ParcelableParameter)IntentCompat.getParcelableExtra($this$getLinkParameter$iv$iv, BundleExtensionsKt.getLINK_PARAMETER(), HomesActivityParameter.class));
From my code I am 100% sure that the intent contains a ParcelableParameter.