Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Commit 5497533

Browse files
Fix program crash when discord client is not initialized and user attempts to change file on editor.
1 parent 9947c5e commit 5497533

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

UI/MainWindow.xaml.cs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -311,16 +311,19 @@ public void UpdateWindowTitle()
311311

312312
outString += " - SPCode";
313313

314-
Program.discordClient.SetPresence(new RichPresence
314+
if (Program.discordClient.IsInitialized)
315315
{
316-
Timestamps = Program.discordTime,
317-
State = someEditorIsOpen ? $"Editing {Path.GetFileName(ee.FullFilePath)}" : "Idle",
318-
Assets = new Assets
316+
Program.discordClient.SetPresence(new RichPresence
319317
{
320-
LargeImageKey = "immagine",
321-
}
322-
});
323-
318+
Timestamps = Program.discordTime,
319+
State = someEditorIsOpen ? $"Editing {Path.GetFileName(ee.FullFilePath)}" : "Idle",
320+
Assets = new Assets
321+
{
322+
LargeImageKey = "immagine",
323+
}
324+
});
325+
}
326+
324327
if (ServerIsRunning) outString = $"{outString} | ({Program.Translations.GetLanguage("ServerRunning")})";
325328
Title = outString;
326329
}

0 commit comments

Comments
 (0)