Skip to content

Commit

Permalink
Fix NullReferenceException accessing Value.
Browse files Browse the repository at this point in the history
  • Loading branch information
pluskal committed Jul 13, 2020
1 parent 7c10982 commit 92a85ed
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Kaitai.Struct.Runtime/ImplicitNullable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Kaitai
public struct ImplicitNullable<T> where T : struct
{
public bool HasValue { get { return this._value.HasValue; } }
public T Value { get { return this._value.Value; } }
public T Value { get => this._value ?? default; }

public ImplicitNullable(T value) : this() { this._value = value; }
public ImplicitNullable(T? value) : this() { this._value = value; }
Expand Down

0 comments on commit 92a85ed

Please sign in to comment.