mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Debugger - Fixed possible crash when LogEvent is null
In theory this shouldn't happen, but I just got a hard crash because of it. Doesn't hurt to check.
This commit is contained in:
parent
9f20f52b22
commit
a7ed4de575
@ -14,7 +14,7 @@ namespace Artemis.UI.Screens.Debugger.Logs;
|
||||
public class LogsDebugView : ReactiveUserControl<LogsDebugViewModel>
|
||||
{
|
||||
private int _lineCount;
|
||||
private TextEditor _textEditor;
|
||||
private TextEditor? _textEditor;
|
||||
|
||||
public LogsDebugView()
|
||||
{
|
||||
@ -31,7 +31,7 @@ public class LogsDebugView : ReactiveUserControl<LogsDebugViewModel>
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
Dispatcher.UIThread.Post(() => _textEditor.ScrollToEnd(), DispatcherPriority.ApplicationIdle);
|
||||
Dispatcher.UIThread.Post(() => _textEditor?.ScrollToEnd(), DispatcherPriority.ApplicationIdle);
|
||||
}
|
||||
|
||||
private void OnTextChanged(object? sender, EventArgs e)
|
||||
|
||||
@ -48,8 +48,11 @@ public class LogsDebugViewModel : ActivatableViewModelBase
|
||||
});
|
||||
}
|
||||
|
||||
private void AddLogEvent(LogEvent logEvent)
|
||||
private void AddLogEvent(LogEvent? logEvent)
|
||||
{
|
||||
if (logEvent is null)
|
||||
return;
|
||||
|
||||
using StringWriter writer = new();
|
||||
_formatter.Format(logEvent, writer);
|
||||
string line = writer.ToString();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user