Skip to content
This repository was archived by the owner on Oct 12, 2020. It is now read-only.

Commit 5106cd0

Browse files
author
c0derMo
committed
- Fixed a bug where the program would crash if invalid filenames are written in the "Output to file" fields
1 parent e98e950 commit 5106cd0

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

SpotifyNowPlaying/SpotifyNowPlaying/Program.cs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,33 @@ static void Main(string[] args)
5151
{
5252
if(OptionManager.nameFile != "")
5353
{
54-
System.IO.File.WriteAllText(OptionManager.nameFile, context.Item.Name);
54+
try {
55+
System.IO.File.WriteAllText(OptionManager.nameFile, context.Item.Name);
56+
} catch (Exception)
57+
{
58+
59+
}
5560
}
5661
if (OptionManager.artistsFile != "")
5762
{
58-
System.IO.File.WriteAllText(OptionManager.artistsFile, artists);
63+
try {
64+
System.IO.File.WriteAllText(OptionManager.artistsFile, artists);
65+
}
66+
catch (Exception)
67+
{
68+
69+
}
5970
}
6071
if (OptionManager.imageFile != "")
6172
{
73+
try {
6274
WebClient client = new WebClient();
6375
client.DownloadFile(image, OptionManager.imageFile);
76+
}
77+
catch (Exception)
78+
{
79+
80+
}
6481
}
6582
}
6683
}

0 commit comments

Comments
 (0)