airbnb / airbnb/DeepLinkDispatch
NullPointerException Crash In Generated class DeepLinkModuleRegistry-> Utils.readMatchIndexFromStrings
- Dominant language
- Kotlin
- Stars
- 4.4k
- Forks
- 414
- PR merge metrics
- No merged PRs in 30d
Description
**Issue Details**
DeepLinkDispatch 6.2.2
Kotlin 1.9.25
KSP 1.9.25-1.0.20
- We started facing this after we updated the Deeplink Dispatch Library to 1.9.25-1.0.20 and moved to KSP from Kapt
- Seems like this is happening kind of one time for per/few users
- Utils.readMatchIndexFromStrings is called from generated class DeepLinkModuleRegistry and its not null.
- We checked the Generated code in DeepLinkModuleRegistry class and string passed is not null.
**`Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'byte[] java.lang.String.getBytes(java.nio.charset.Charset)' on a null object reference
at com.airbnb.deeplinkdispatch.base.Utils.readMatchIndexFromStrings(Utils.kt:47)
at com.navigation.api.deeplink.DeepLinkModuleRegistry.(DeepLinkModuleRegistry.java)
at com.entrypoint.Initializer$Companion.getDeeplinkParsers(Initializer.kt:339)
at com.entrypoint.Initializer.parser$entry_point_release(Initializer.kt:314)
at com.entrypoint.Initializer.initNavigator(Initializer.kt:163)
at com.entrypoint.Initializer.init(Initializer.kt:142)
at com.home.internal.initializer.Initializers.init(Initializers.kt:95)
at com.home.internal.initializer.Initializers.access$getModules$p(Initializers.kt:21)
at com.home.internal.initializer.Initializers$optPureRegistration$1$2$1.invokeSuspend(Initializers.kt:49)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:15811)`**
`import com.airbnb.deeplinkdispatch.BaseRegistry;
import com.airbnb.deeplinkdispatch.base.Utils;
public final class DeepLinkModuleRegistry extends BaseRegistry {
public DeepLinkModuleRegistry() {
super(Utils.readMatchIndexFromStrings(new String[] {matchIndex0(),}),
new String[] {});
}
private static String matchIndex0() {
return "it has big generated string";
}
}
`
Contributor guide
Research direction
Start with Utils.kt:47 and the generated DeepLinkModuleRegistry constructor shown in the report; compare the value passed by matchIndex0() with the null encountered by readMatchIndexFromStrings(). Trace the KSP-generated registry initialization using the supplied stack trace, and consider the issue complete when the intermittent initialization crash is explained and a verified fix prevents it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100