# NullPointerException on VideoSize when phone is rotated with share canvas

**URL:** <https://devforum.zoom.us/t/nullpointerexception-on-videosize-when-phone-is-rotated-with-share-canvas/122747>\
**Category:** Android\
**Created:** [December 19, 2024, 9:54am UTC](https://devforum.zoom.us/t/nullpointerexception-on-videosize-when-phone-is-rotated-with-share-canvas/122747 "2024-12-19T09:54:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jledwon](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jledwon/32/59907_2.png) [@jledwon](https://devforum.zoom.us/u/jledwon)\
**Post date:** [December 19, 2024, 9:54am UTC](https://devforum.zoom.us/t/nullpointerexception-on-videosize-when-phone-is-rotated-with-share-canvas/122747/1 "2024-12-19T09:54:56Z")

</div>

Hi,  
I have encountered the crash in the Android SDK when mobile device is receiving the share stream from the remote participant.

I am using Jetpack Compose, so the `ZoomVideoSDKVideoView` is wrapped in following code:

```auto
   val videoCanvas = zoom.findUser(userId)?.shareCanvas ?: return
    var subscribed by remember { mutableStateOf(false) }

    AndroidView(
        modifier = modifier,
        factory = { context ->
            ZoomVideoSDKVideoView(context).apply {
                setZOrderOnTop(false)
            }
        },
        update = { view ->
            if (!subscribed) {
                videoCanvas.subscribe(
                    view,
                    ZoomVideoSDKVideoAspect.ZoomVideoSDKVideoAspect_Original,
                    ZoomVideoSDKVideoResolution.ZoomVideoSDKResolution_Auto
                )
                subscribed = true
            } else {
                videoCanvas.setAspectMode(
                    view,
                    ZoomVideoSDKVideoAspect.ZoomVideoSDKVideoAspect_Original
                )
            }
        },
        onRelease = { view ->
            if (subscribed) {
                videoCanvas.unSubscribe(view)
            }
        }
    )

```

Crash is following:

```auto
java.lang.NullPointerException: Attempt to read from field 'int com.zipow.nydus.VideoSize.width'
    on a null object reference in method 'us.zoom.video_sdk.z1 us.zoom.internal.video.SDKShareUnit.createRenderUnitArea(us.zoom.video_sdk.z1, com.zipow.nydus.VideoSize)'
	at us.zoom.internal.video.SDKShareUnit.createRenderUnitArea(SDKShareUnit.java:1)
	at us.zoom.internal.video.SDKShareUnit.updateUnitInfo(SDKShareUnit.java:22)
	at us.zoom.internal.video.SDKShareUnit.updateUnitShare(SDKShareUnit.java:3)
	at us.zoom.internal.video.SDKShareUnit.zoomToFitUnit(SDKShareUnit.java:12)
	at us.zoom.internal.video.SDKShareUnit.updateUnit(SDKShareUnit.java:4)
	at us.zoom.internal.video.SDKVideoUnitMgr.updateShareVideoUnit(SDKVideoUnitMgr.java:3)
	at us.zoom.internal.video.SDKVideoUnitMgr.updateUnitsByGroupIndex(SDKVideoUnitMgr.java:5)
	at us.zoom.internal.video.SDKVideoRender.onUpdateUnit(SDKVideoRender.java:1)
	at us.zoom.internal.video.SDKVideoRender.onSurfaceChanged(SDKVideoRender.java:14)
	at us.zoom.internal.video.SDKVideoRender.access$100(SDKVideoRender.java:1)
	at us.zoom.internal.video.SDKVideoRender$2.run(SDKVideoRender.java:1)
	at android.os.Handler.handleCallback(Handler.java:984)
	at android.os.Handler.dispatchMessage(Handler.java:104)
	at android.os.Looper.loopOnce(Looper.java:238)
	at android.os.Looper.loop(Looper.java:357)
	at android.app.ActivityThread.main(ActivityThread.java:8149)
	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:957)

```

**Which Android [Video SDK](https://developers.zoom.us/docs/video-sdk) version?**

`us.zoom.videosdk:zoomvideosdk-core:1.13.11` and `us.zoom.videosdk:zoomvideosdk-videoeffects:1:13:11`

**To Reproduce**

1. Subscribe to remote participant sharing
2. Rotate the device
3. Crash happens

**Smartphone (please complete the following information):**

- Device: Samsung SM-A528B , Motorola g52
- OS: Android 13

This is a duplicate of [NullPointerException on VideoSize when phone is rotated together with share canvas](https://devforum.zoom.us/t/nullpointerexception-on-videosize-when-phone-is-rotated-together-with-share-canvas/120916/1), but this one is closed and this bug still affects us in 1.13.11.

---

<div class="post-metadata">

**Author:** ![ekaansh.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/ekaansh.zoom/32/55004_2.png) [@ekaansh.zoom](https://devforum.zoom.us/u/ekaansh.zoom)\
**Post date:** [December 19, 2024, 2:59pm UTC](https://devforum.zoom.us/t/nullpointerexception-on-videosize-when-phone-is-rotated-with-share-canvas/122747/2 "2024-12-19T14:59:40Z")

</div>

Hi @jledwon this looks like a bug, I’ll flag this to the team. Can you share a screen-recording or minimal reproduction to help us fix this faster?

---

<div class="post-metadata">

**Author:** ![jledwon](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jledwon/32/59907_2.png) [@jledwon](https://devforum.zoom.us/u/jledwon)\
**Post date:** [December 20, 2024, 9:38am UTC](https://devforum.zoom.us/t/nullpointerexception-on-videosize-when-phone-is-rotated-with-share-canvas/122747/3 "2024-12-20T09:38:35Z")

</div>

Hi @ekaansh.zoom,

Many thanks for your reply. I provided the code that causes the crash with the steps (video rotation) in the ticket, if they are not enough, or if something is unclear please let me know.

---

<div class="post-metadata">

**Author:** ![ekaansh.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/ekaansh.zoom/32/55004_2.png) [@ekaansh.zoom](https://devforum.zoom.us/u/ekaansh.zoom)\
**Post date:** [December 20, 2024, 3:00pm UTC](https://devforum.zoom.us/t/nullpointerexception-on-videosize-when-phone-is-rotated-with-share-canvas/122747/4 "2024-12-20T15:00:36Z")

</div>

Edit: Fixed, releasing soon.  
I’ve created a ticket with engineering, will update here.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [January 20, 2025, 1:00am UTC](https://devforum.zoom.us/t/nullpointerexception-on-videosize-when-phone-is-rotated-with-share-canvas/122747/5 "2025-01-20T01:00:39Z")

</div>

Closed on January 20, 2025, 1:00am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
