Skip to content

Commit 173b82a

Browse files
committed
improved Nullable<T>.GetValue
1 parent fd213bc commit 173b82a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Source/Base/Spring.pas

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,7 +1557,7 @@ Nullable<T> = record
15571557
class function EqualsComparer(const left, right: T): Boolean; static;
15581558
class function EqualsInternal(const left, right: T): Boolean; static; inline;
15591559
class procedure InitEquals; static;
1560-
function GetValue: T; inline;
1560+
function GetValue: T;
15611561
function GetHasValue: Boolean; inline;
15621562
public
15631563
/// <summary>
@@ -8364,9 +8364,9 @@ function Nullable<T>.GetHasValue: Boolean;
83648364

83658365
function Nullable<T>.GetValue: T;
83668366
begin
8367-
if not HasValue then
8368-
Guard.RaiseNullableHasNoValue;
8369-
Result := fValue;
8367+
if HasValue then
8368+
Exit(fValue);
8369+
Guard.RaiseNullableHasNoValue;
83708370
end;
83718371

83728372
function Nullable<T>.GetValueOrDefault: T;

0 commit comments

Comments
 (0)