Skip to content

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.dylanvann.fastimage.FastImageSource.isResource()' on a null object reference #952

Open
@brandonkhy14

Description

@brandonkhy14

Describe the bug

The app crashed in release mode for android when run react-native-fast-image with defaultSouce, working well in debug mode.

Remark: iOS working well.

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.dylanvann.fastimage.FastImageSource.isResource()' on a null object reference at com.dylanvann.fastimage.FastImageViewConverter.getOptions(FastImageViewConverter.java:111) at com.dylanvann.fastimage.FastImageViewWithUrl.onAfterUpdate(FastImageViewWithUrl.java:143) at com.dylanvann.fastimage.FastImageViewManager.onAfterUpdateTransaction(FastImageViewManager.java:181) at com.dylanvann.fastimage.FastImageViewManager.onAfterUpdateTransaction(FastImageViewManager.java:33) at com.facebook.react.uimanager.ViewManager.updateProperties(ViewManager.java:88) at com.facebook.react.uimanager.ViewManager.createViewInstance(ViewManager.java:188) at com.facebook.react.uimanager.ViewManager.createView(ViewManager.java:115) at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:281) at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:194) at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.dispatchPendingNonBatchedOperations(UIViewOperationQueue.java:1110) at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1081) at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29) at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:175) at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:85) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1010) at android.view.Choreographer.doCallbacks(Choreographer.java:823) at android.view.Choreographer.doFrame(Choreographer.java:755) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:998) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6846) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:883)

To Reproduce
<FastImage defaultSource={require('./default-images/image-1.jpg')} source={{uri: 'https://pbs.twimg.com/profile_images/1455185376876826625/s1AjSxph_400x400.jpg'}} resizeMode={'cover'} style={{ height: 220, width: PRODUCT_CARD_WIDTH, borderTopLeftRadius: 10, borderTopRightRadius: 10, }} />

Expected behavior
Expected to show default picture from defaultSource if source image is unavailable.

Screenshots
App crashed directly when screen loaded.

Dependency versions

  • React Native version: 0.70.2
  • React version: 18.1.0
  • React Native Fast Image version: 8.6.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions