mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-08 11:34:05 +02:00
Fix a few nullability checks
This commit is contained in:
parent
864ff6206d
commit
896f1a99c0
lib/TweetLib.Core
@ -94,7 +94,7 @@ public bool TryGetValue(K1 outerKey, K2 innerKey, out V value){
|
||||
return innerDict.TryGetValue(innerKey, out value);
|
||||
}
|
||||
else{
|
||||
value = default;
|
||||
value = default!;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ public Result(T value){
|
||||
}
|
||||
|
||||
public Result(Exception exception){
|
||||
this.value = default;
|
||||
this.value = default!;
|
||||
this.exception = exception ?? throw new ArgumentNullException(nameof(exception));
|
||||
}
|
||||
|
||||
@ -25,12 +25,12 @@ public void Handle(Action<T> onSuccess, Action<Exception> onException){
|
||||
onSuccess(value);
|
||||
}
|
||||
else{
|
||||
onException(exception!!);
|
||||
onException(exception!);
|
||||
}
|
||||
}
|
||||
|
||||
public Result<R> Select<R>(Func<T, R> map){
|
||||
return HasValue ? new Result<R>(map(value)) : new Result<R>(exception!!);
|
||||
return HasValue ? new Result<R>(map(value)) : new Result<R>(exception!);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user