Skip to content

Commit

Permalink
Fix issue with queue metrics instrument null reference
Browse files Browse the repository at this point in the history
  • Loading branch information
ejsmith committed Aug 31, 2024
1 parent a295d13 commit e60b8f4
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/Foundatio/Utility/InstrumentsValues.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,38 @@ public InstrumentsValues(Func<(T1, T2, T3)> readValues)
public T1 GetValue1()
{
if (!_value1.HasValue)
{
(_value1, _value2, _value3) = UpdateValues();
}

if (_value1 == null)
return default;

T1 value = _value1.Value;
_value1 = null;
return value;

}

public T2 GetValue2()
{
if (!_value2.HasValue)
{
(_value1, _value2, _value3) = UpdateValues();
}

if (_value2 == null)
return default;

T2 value = _value2.Value;
_value2 = null;
return value;

}

public T3 GetValue3()
{
if (!_value3.HasValue)
{
(_value1, _value2, _value3) = UpdateValues();
}

if (_value3 == null)
return default;

T3 value = _value3.Value;
_value3 = null;
Expand Down

0 comments on commit e60b8f4

Please sign in to comment.