wordpress-mobile / WordPress-Android

WordPress for Android
http://android.wordpress.org
GNU General Public License v2.0
2.96k stars 1.31k forks source link

NullPointerException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkNotNullParame... #15499

Open AliSoftware opened 2 years ago

AliSoftware commented 2 years ago

Sentry Url: https://sentry.io/share/issue/bc015811a5544b44beec85bc52fd0994/ User Count: 1 Count: 2 First Release: 18.5-rc-2 First Seen: 2021-10-26T02:57:52.922000Z Last Seen: 2021-10-26T02:57:59Z 24 Hours: 0 30 Days: 2

NullPointerException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkNotNullParameter, parameter username
     at org.wordpress.android.fluxc.network.xmlrpc.media.MediaXMLRPCClient.uploadMedia(MediaXMLRPCClient.java:175)
     at org.wordpress.android.fluxc.store.MediaStore.performUploadMedia(MediaStore.java:793)
     at org.wordpress.android.fluxc.store.MediaStore.onAction(MediaStore.java:494)
...
(1 additional frame(s) were not displayed)

Super low user and event count, and I usually don't escalate as a GH issue for so low numbers… but since this is a brand new introduced on the current beta (which isn't out yet, which can also explain low counts), I figured better flag it sooner than later. \cc @jhnstn I'll let you decide on priority.

jd-alexander commented 2 years ago

I investigated this issue. It seems when media is being uploaded the SiteModel's username is null and causing this crash. Since this value can be null, the API design should cover this case. The offending line is here Based on how error cases are handled there, a MediaError should encapsulate this result so that a crash does not occur.