Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 7709a8b

Browse files
committed
Make sure ToString doesn't make String.Format throw
1 parent 6182345 commit 7709a8b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/GitHub.Api/Primitives/TheVersion.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public struct TheVersion : IComparable<TheVersion>
3131
[NotSerialized] private string[] stringParts;
3232
[NotSerialized] private int parts;
3333
[NotSerialized] private bool initialized;
34-
35-
public string Version { get; set; }
34+
[NotSerialized] private string version;
35+
public string Version { get { if (version == null) version = String.Empty; return version; } set { version = value; } }
3636

3737
private static readonly Regex regex = new Regex(versionRegex);
3838

@@ -46,7 +46,7 @@ private TheVersion Initialize(string version)
4646
if (initialized)
4747
return this;
4848

49-
this.Version = version?.Trim();
49+
this.Version = version?.Trim() ?? String.Empty;
5050

5151
isAlpha = false;
5252
isBeta = false;

0 commit comments

Comments
 (0)