Skip to content

Commit

Permalink
Backend/Ether: refactor null checks
Browse files Browse the repository at this point in the history
Make all null checks use isNull function as it's the most
reliable way to test if value is null.
  • Loading branch information
webwarrior-ws committed Aug 21, 2024
1 parent ad488f8 commit 78e83d4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/GWallet.Backend/Ether/EtherServer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ module Server =
raise <| ServerUnavailableException(exMsg, httpReqEx)

// TODO: report this one as a warning to sentry?
if httpReqEx.InnerException <> null &&
if not (isNull httpReqEx.InnerException) &&
httpReqEx.InnerException :? System.Runtime.InteropServices.COMException then
// got this once, with the exception message
// "the text associated with this error code could not be found.
Expand Down Expand Up @@ -302,7 +302,7 @@ module Server =
// FIXME: report this UWP bug (see commit message for full stacktrace)
if Xamarin.Essentials.DeviceInfo.Platform.Equals Xamarin.Essentials.DevicePlatform.UWP &&
httpReqEx.InnerException <> null && httpReqEx.InnerException.GetType() = typeof<Exception> then
not (isNull httpReqEx.InnerException) && httpReqEx.InnerException.GetType() = typeof<Exception> then
raise <| ServerCannotBeResolvedException(httpReqEx.InnerException.Message, ex)
*)

Expand Down Expand Up @@ -567,7 +567,7 @@ module Server =
let task = web3.Eth.GetBalance.SendRequestAsync (address, null, cancelToken)
return! Async.AwaitTask task
}
if Object.ReferenceEquals(balance, null) then
if isNull balance then
raise <|
AbnormalNullValueInJsonResponseException
AbnormalNullValueInJsonResponseException.BalanceJobErrorMessage
Expand Down

0 comments on commit 78e83d4

Please sign in to comment.