Adaptive Cards v1.2.0 throwing NullPointerException while rendering
See original GitHub issuePlatform
Android
Author or host
Host
Version of SDK
io.adaptivecards:adaptivecards-android:1.2.0
Issue
I just updated the adaptive cards version on my native app from v1.1.0 to v1.2.0. After making the necessary changes around AdaptiveCardRenderer.render and BaseCardElementRenderer.render, when I try to run the app, I get a NullPointerException in the AdaptiveCardRenderer.getInstance.render() method. It complains about AdaptiveCards::FeatureRegistration const & reference being null. Below is the snippet of the log:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dynamicsignal.adaptivecards/com.dynamicsignal.adaptivecards.AdaptiveCardActivity}: java.lang.NullPointerException: AdaptiveCards::FeatureRegistration const & reference is null at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2678) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2743) at android.app.ActivityThread.-wrap12(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1490) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6165) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778) Caused by: java.lang.NullPointerException: AdaptiveCards::FeatureRegistration const & reference is null at io.adaptivecards.objectmodel.AdaptiveCardObjectModelJNI.BaseElement_MeetsRequirements(Native Method) at io.adaptivecards.objectmodel.BaseElement.MeetsRequirements(BaseElement.java:125) at io.adaptivecards.renderer.registration.CardRendererRegistration.render(CardRendererRegistration.java:280) at io.adaptivecards.renderer.AdaptiveCardRenderer.internalRender(AdaptiveCardRenderer.java:156) at io.adaptivecards.renderer.AdaptiveCardRenderer.render(AdaptiveCardRenderer.java:59)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:6 (4 by maintainers)
Top GitHub Comments
It’s not a regression, it’s a new bug due to the inclusion of FeatureRegistration (and we may not be checking if the feature registration is empty). As a work around a dummy FeatureRegistration object can be created and registered so the card renders correctly; the exception is thrown when this function is called
cardElement.MeetsRequirements(featureRegistration)
We may have to check if this doesn’t happen in other platforms too
@tnev , this is an android only issue which is going to be addressed in the version1.2.1 of AdaptiveCards to be released at the end of this month