Skip to content

Commit d8916c5

Browse files
committed
fix: NullReferenceException occurs when Complete is called before AppendLine (#2305)
Signed-off-by: leo <longshuang@msn.cn>
1 parent a6bbcab commit d8916c5

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎src/ViewModels/CommandLog.cs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ public void AppendLine(string line = null)
6363
else
6464
{
6565
var newline = line ?? string.Empty;
66-
_builder.AppendLine(newline);
66+
if (_builder != null)
67+
_builder.AppendLine(newline);
68+
else
69+
_content = $"{_content}{newline}\n";
6770

6871
foreach (var receiver in _receivers)
6972
receiver.OnReceiveCommandLog(newline);

0 commit comments

Comments
 (0)