From aa71ff87616b4d9a94ad6dd1e138f88006ea8019 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sat, 1 Feb 2025 22:15:31 +0000 Subject: [PATCH] Avoid null reference exceptions --- src/Yavsc/Helpers/AsciiDocHelpers.cs | 4 ++-- src/Yavsc/Yavsc.csproj | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Yavsc/Helpers/AsciiDocHelpers.cs b/src/Yavsc/Helpers/AsciiDocHelpers.cs index 133942f1..a641960e 100644 --- a/src/Yavsc/Helpers/AsciiDocHelpers.cs +++ b/src/Yavsc/Helpers/AsciiDocHelpers.cs @@ -90,11 +90,11 @@ namespace Yavsc.Helpers case "AsciiDocNet.TextLiteral": var tl = elt as TextLiteral; - if (tl.Attributes.Anchor!=null) + if (tl?.Attributes.Anchor!=null) { sb.AppendFormat("{1} ", tl.Attributes.Anchor.Id, tl.Attributes.Anchor.XRefLabel); } - sb.Append(tl.Text); + if (tl!=null) sb.Append(tl.Text); break; case "AsciiDocNet.Emphasis": diff --git a/src/Yavsc/Yavsc.csproj b/src/Yavsc/Yavsc.csproj index 86cfe39f..698fa771 100644 --- a/src/Yavsc/Yavsc.csproj +++ b/src/Yavsc/Yavsc.csproj @@ -42,7 +42,7 @@ - +