Skip to content

Commit

Permalink
Fix: nullref in websocket tokens endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotrekol committed Apr 2, 2021
1 parent bf1c9e8 commit a0430ee
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions plugins/WebSocketDataSender/WebSocketKeyValueEndpoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ public async Task SendLoop(IWebSocketContext context)
continue;
var kvValue = GetValue(watchedKv.Key);

var valueIsDifferent = (kvValue is double kvv)
? watchedKv.Value == null || Math.Abs(kvv - (double)watchedKv.Value) > double.Epsilon
: !kvValue.Equals(watchedKv.Value);
var valueIsDifferent = (kvValue == null || watchedKv.Value == null)
? kvValue != watchedKv.Value
: (kvValue is double kvv)
? watchedKv.Value == null || Math.Abs(kvv - (double)watchedKv.Value) > double.Epsilon
: !kvValue.Equals(watchedKv.Value);
if (valueIsDifferent)
{
watchedKeyValues[watchedKv.Key] = kvValue;
Expand Down

0 comments on commit a0430ee

Please sign in to comment.