woocommerce / woocommerce-android

WooCommerce Android app
https://www.woocommerce.com/mobile
GNU General Public License v2.0
264 stars 133 forks source link

Crash: java.lang.NullPointerException: site.username must not be null #10048

Open 0nko opened 8 months ago

0nko commented 8 months ago

After installing WooCommerce on a fresh self-hosted site using a Webview and going back, the app crashes.

To reproduce:

  1. Enable Don't keep Activities
  2. Create a self hosted site without WooCommerce
  3. Log in using username/password
  4. From the missing Woo error screen, navigate to wp-admin login page and log in
  5. Install & activate WooCommerce plugin
  6. Tap on the close button of the webview
  7. Notice the app crashed

Stacktrace:

java.lang.NullPointerException: site.username must not be null
    at org.wordpress.android.fluxc.network.rest.wpapi.applicationpasswords.ApplicationPasswordsManager.getOrFetchUsername(ApplicationPasswordsManager.kt:77)
    at org.wordpress.android.fluxc.network.rest.wpapi.applicationpasswords.ApplicationPasswordsManager.getApplicationCredentials(ApplicationPasswordsManager.kt:58)
    at org.wordpress.android.fluxc.network.rest.wpapi.applicationpasswords.ApplicationPasswordsNetwork.executeGsonRequest(ApplicationPasswordsNetwork.kt:86)
    at org.wordpress.android.fluxc.network.rest.wpapi.applicationpasswords.ApplicationPasswordsNetwork.executeGsonRequest$default(ApplicationPasswordsNetwork.kt:39)
    at org.wordpress.android.fluxc.network.rest.wpapi.applicationpasswords.ApplicationPasswordsNetwork.executeGetGsonRequest(ApplicationPasswordsNetwork.kt:147)
    at org.wordpress.android.fluxc.network.rest.wpcom.wc.WooNetwork.executeGetGsonRequest(WooNetwork.kt:43)
    at org.wordpress.android.fluxc.network.rest.wpcom.wc.WooNetwork.executeGetGsonRequest$default(WooNetwork.kt:28)
    at org.wordpress.android.fluxc.network.rest.wpcom.wc.user.WCUserRestClient.fetchUserInfo(WCUserRestClient.kt:21)
    at org.wordpress.android.fluxc.store.WCUserStore$fetchUserRole$2.invokeSuspend(WCUserStore.kt:25)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
    Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@8c80a74, Dispatchers.Main.immediate]
peril-woocommerce[bot] commented 8 months ago
Fails
:no_entry_sign: Please add a feature label to this issue. e.g. 'feature: stats'

Generated by :no_entry_sign: dangerJS

peril-woocommerce[bot] commented 8 months ago
Fails
:no_entry_sign: Please add a feature label to this issue. e.g. 'feature: stats'

Generated by :no_entry_sign: dangerJS