redth-org / BTProgressHUD

Port to Xamarin.iOS of the SVProgressHUD
Other
118 stars 64 forks source link

ForDefaultWindow() can return `null` #103

Closed Cheesebaron closed 1 year ago

Cheesebaron commented 1 year ago

🐛 Bug Report

I'm seeing a bunch of crashes in AppCenter with trace:

SIGABRT: Arg_NullReferenceException

    BigTed.ProgressHUD.For(UIWindow window)
    BigTed.ProgressHUD.ForDefaultWindow()
    BigTed.BTProgressHUD.Dismiss()
    TrackMan.DrivingRangeApp.iOS.Services.ProgressHudService.<>c__DisplayClass8_0.<<Dismiss>b__0>d.MoveNext()
    ObjCRuntime.Runtime.ThrowException(IntPtr )
    UIKit.UIApplication.UIApplicationMain(Int32 , String[] , IntPtr , IntPtr )
    UIKit.UIApplication.Main(String[] , Type , Type )
    Program.<Main>$(String[] args)

Looks like ForDefaultWindow() has a null forgiving ! on the window instance passed to the For() method, which makes it crash if it is actually null as For() doesn't expect it to be null.

❓ Expected behavior

No crashes please.

🪜 Reproduction steps

🤷‍♂️

🛠 Configuration

📦 Package Version: 2.0.0

📱 iOS Version: Mainly iOS 16