Skip to content

Commit 1c75d3f

Browse files
committed
Fix crash in options window
1 parent 3ec8e2f commit 1c75d3f

File tree

5 files changed

+14
-26
lines changed

5 files changed

+14
-26
lines changed

Cirilla/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@
5151
// You can specify all the values or you can default the Build and Revision Numbers
5252
// by using the '*' as shown below:
5353
// [assembly: AssemblyVersion("1.0.*")]
54-
[assembly: AssemblyVersion("0.6.0.0")]
55-
[assembly: AssemblyFileVersion("0.6.0.0")]
54+
[assembly: AssemblyVersion("0.6.1.0")]
55+
[assembly: AssemblyFileVersion("0.6.1.0")]

Cirilla/ViewModels/GMDViewModel.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public GMDViewModel(string path) : base(path)
4343

4444
// Entries
4545
for (int i = 0; i < _context.Entries.Count; i++)
46-
Entries.Add(new GMDEntryViewModel(i, _context.Entries[i]));
46+
Entries.Add(new GMDEntryViewModel(i, _context.Entries[i]));
4747

4848
// Filtered Entries CollectionViewSource
4949
FilteredEntries = CollectionViewSource.GetDefaultView(Entries);
@@ -90,7 +90,13 @@ public void AddEntryNoKey()
9090
Entries.Add(vm);
9191
}
9292

93-
public bool IsUnsafeModeEnabled() => Properties.Settings.Default.Config.UnsafeModeEnabled;
93+
public bool IsUnsafeModeEnabled()
94+
{
95+
if (Properties.Settings.Default.Config != null)
96+
return Properties.Settings.Default.Config.UnsafeModeEnabled;
97+
98+
return false;
99+
}
94100

95101
public void TriggerSearch()
96102
{

Cirilla/ViewModels/MainWindowViewModel.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,18 +109,12 @@ public void SaveInWorkingDirectory()
109109

110110
public bool CanSaveInWorkingDirectory()
111111
{
112-
try
113-
{
114-
if (SelectedItem is FileTypeTabItemViewModelBase item && Properties.Settings.Default.Config.WorkingDirectoryPath != null)
112+
if (SelectedItem is FileTypeTabItemViewModelBase item)
113+
if (Properties.Settings.Default.Config != null && Properties.Settings.Default.Config.WorkingDirectoryPath != null)
115114
return Directory.Exists(Properties.Settings.Default.Config.WorkingDirectoryPath)
116115
&& GetFullRelativePathForGameFile(item.Filepath) != null;
117116

118-
return false;
119-
}
120-
catch
121-
{
122-
return false;
123-
}
117+
return false;
124118
}
125119

126120
private string GetFullRelativePathForGameFile(string path)

Cirilla/Windows/OptionsWindow.xaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
66
xmlns:root="clr-namespace:Cirilla"
77
mc:Ignorable="d"
8-
Title="Options" Height="300" Width="600" Closed="Window_Closed">
8+
Title="Options" Height="300" Width="600">
99
<Grid Margin="10">
1010
<Grid.RowDefinitions>
1111
<RowDefinition Height="*"/>
@@ -70,7 +70,6 @@
7070
<ColumnDefinition Width="100"/>
7171
</Grid.ColumnDefinitions>
7272

73-
<Button Grid.Column="0" Content="Close &amp; discard changes" Click="Close_Click"/>
7473
<Button Grid.Column="2" Content="Save" Click="Save_Click"/>
7574
</Grid>
7675
</Grid>

Cirilla/Windows/OptionsWindow.xaml.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,9 @@ private void ExtractedFiles_Browse(object sender, RoutedEventArgs e)
3333
}
3434
}
3535

36-
private void Close_Click(object sender, RoutedEventArgs e)
37-
{
38-
Properties.Settings.Default.Reload();
39-
Close();
40-
}
41-
4236
private void Save_Click(object sender, RoutedEventArgs e)
4337
{
4438
Properties.Settings.Default.Save();
4539
}
46-
47-
private void Window_Closed(object sender, System.EventArgs e)
48-
{
49-
Properties.Settings.Default.Reload();
50-
}
5140
}
5241
}

0 commit comments

Comments
 (0)