Skip to content

Commit 39d46d1

Browse files
lduchosalclaude
andcommitted
fix: NullReferenceException on IPv6 /128 networks in CLI output
Removed redundant .ToString() calls on nullable properties (Broadcast, FirstUsable, LastUsable, Network, Netmask). string.Format handles null safely, .ToString() on null does not. Also fixed release workflow: macos-13 runner retired, --skip-duplicate for NuGet push. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c785615 commit 39d46d1

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/ConsoleApplication/Program.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,12 @@ private static void PrintNetwork(ProgramContext ac, IPNetwork2 ipn)
262262

263263
if (ac.Network)
264264
{
265-
sw.WriteLine("Network : {0}", ipn.Network.ToString());
265+
sw.WriteLine("Network : {0}", ipn.Network);
266266
}
267267

268268
if (ac.Netmask)
269269
{
270-
sw.WriteLine("Netmask : {0}", ipn.Netmask.ToString());
270+
sw.WriteLine("Netmask : {0}", ipn.Netmask);
271271
}
272272

273273
if (ac.Cidr)
@@ -277,17 +277,17 @@ private static void PrintNetwork(ProgramContext ac, IPNetwork2 ipn)
277277

278278
if (ac.Broadcast)
279279
{
280-
sw.WriteLine("Broadcast : {0}", ipn.Broadcast.ToString());
280+
sw.WriteLine("Broadcast : {0}", ipn.Broadcast);
281281
}
282282

283283
if (ac.FirstUsable)
284284
{
285-
sw.WriteLine("FirstUsable : {0}", ipn.FirstUsable.ToString());
285+
sw.WriteLine("FirstUsable : {0}", ipn.FirstUsable);
286286
}
287287

288288
if (ac.LastUsable)
289289
{
290-
sw.WriteLine("LastUsable : {0}", ipn.LastUsable.ToString());
290+
sw.WriteLine("LastUsable : {0}", ipn.LastUsable);
291291
}
292292

293293
if (ac.Usable)

0 commit comments

Comments
 (0)