woocommerce / woocommerce-android

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

NumberFormatException: empty String #12528

Closed sentry-io[bot] closed 4 days ago

sentry-io[bot] commented 1 week ago

Sentry Issue: WOOCOMMERCE-ANDROID-DFV

NumberFormatException: empty String
    at com.woocommerce.android.model.ShippingPackageKt.toAppModel(ShippingPackage.kt:82)
    length = dimensionsParts[0].trim().toFloat(),
    at com.woocommerce.android.ui.orders.shippinglabels.ShippingLabelRepository.getShippingPackages(ShippingLabelRepository.kt:80)
    list.add(it.toAppModel())
    at com.woocommerce.android.ui.orders.shippinglabels.ShippingLabelRepository$getShippingPackages$1.invokeSuspend(ShippingLabelRepository.kt:0)
...
(13 additional frame(s) were not displayed)

Describe the bug Crash When Attempting to Add Package Details within Create Shipping Label Flow

To Reproduce Steps to reproduce the behavior:

  1. Enable Shipping labels on the app or log into a site that has shipping labels enabled
  2. Follow the steps from the screen recording below and see if the app crashes with the following stacktrace:
FATAL EXCEPTION: main
Process: com.woocommerce.android, PID: 14806
java.lang.NumberFormatException: empty String
    at jdk.internal.math.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1842)
    at jdk.internal.math.FloatingDecimal.parseFloat(FloatingDecimal.java:122)
    at java.lang.Float.parseFloat(Float.java:485)
    at com.woocommerce.android.model.ShippingPackageKt.toAppModel(ShippingPackage.kt:82)
    at com.woocommerce.android.ui.orders.shippinglabels.ShippingLabelRepository.getShippingPackages(ShippingLabelRepository.kt:80)
    at com.woocommerce.android.ui.orders.shippinglabels.ShippingLabelRepository$getShippingPackages$1.invokeSuspend(ShippingLabelRepository.kt:0)

Screenshots

https://github.com/user-attachments/assets/1c6c25f9-0bc7-4c49-9840-3d96825ace78

Expected behavior The app should not crash when attempting to add package details

dangermattic commented 1 week ago

🚫 Please add a type label (e.g. type: enhancement) and a feature label (e.g. feature: stats) to this issue.