1
0
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:
chylex 2019-05-26 14:26:30 +02:00
parent 864ff6206d
commit 896f1a99c0
2 changed files with 4 additions and 4 deletions
lib/TweetLib.Core

View File

@ -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;
} }
} }

View File

@ -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!);
} }
} }
} }