Skip to content

Commit 62b20a6

Browse files
tg123Copilot
andauthored
Update src/KubernetesClient/Models/ResourceQuantity.cs
Co-authored-by: Copilot <[email protected]>
1 parent a20419b commit 62b20a6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/KubernetesClient/Models/ResourceQuantity.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,12 @@ private static bool HasMantissa(Fraction value)
171171

172172
public static implicit operator decimal(ResourceQuantity v)
173173
{
174+
// Handle default/uninitialized struct by returning zero
175+
// Fraction is a struct, so check if _unitlessValue is zero
176+
if (v._unitlessValue.IsZero)
177+
{
178+
return 0m;
179+
}
174180
return v.ToDecimal();
175181
}
176182

0 commit comments

Comments
 (0)