File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,14 +19,20 @@ public partial class StorageTaskSnapshot
1919 {
2020 public StorageTask GetTask ( )
2121 {
22+ if ( _Task == IntPtr . Zero )
23+ throw new InvalidOperationException ( "Firebase Storage task snapshot does not contain a task." ) ;
24+
2225 var task = Runtime . GetNSObject < StorageTask > ( _Task ) ;
23- return task ;
26+ return task ?? throw new InvalidOperationException ( "Unable to resolve Firebase Storage task." ) ;
2427 }
2528
2629 public T GetTask < T > ( ) where T : StorageTask
2730 {
31+ if ( _Task == IntPtr . Zero )
32+ throw new InvalidOperationException ( "Firebase Storage task snapshot does not contain a task." ) ;
33+
2834 var task = Runtime . GetNSObject < T > ( _Task ) ;
29- return task ;
35+ return task ?? throw new InvalidOperationException ( $ "Unable to resolve Firebase Storage task as { typeof ( T ) . FullName } ." ) ;
3036 }
3137 }
3238}
You can’t perform that action at this time.
0 commit comments