mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-06-01 02:34:04 +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);
|
return innerDict.TryGetValue(innerKey, out value);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
value = default;
|
value = default!;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ public Result(T value){
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Result(Exception exception){
|
public Result(Exception exception){
|
||||||
this.value = default;
|
this.value = default!;
|
||||||
this.exception = exception ?? throw new ArgumentNullException(nameof(exception));
|
this.exception = exception ?? throw new ArgumentNullException(nameof(exception));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,12 +25,12 @@ public void Handle(Action<T> onSuccess, Action<Exception> onException){
|
|||||||
onSuccess(value);
|
onSuccess(value);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
onException(exception!!);
|
onException(exception!);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result<R> Select<R>(Func<T, R> map){
|
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