Skip to content

Commit cc6be19

Browse files
authored
Merge pull request #1044 from ionite34/fix-index-range-crash
Fix some index out of range errors & format dates by culture
2 parents 09cc5ba + 6ae7171 commit cc6be19

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2
1414
### Changed
1515
- Updated install for kohya_ss to support RTX 5000-series GPUs
1616
- (pre.2 re-release) Merged Inference GGUF workflows into the UNet model loader option (no longer need to choose GGUF separately)
17+
- (pre.2 re-release) Updated some date strings to take into account the user's locale
18+
- (pre.2 re-release) Fixed some crashes when using Accelerated Model Discovery
1719
### Fixed
1820
- Fixed Inference ControlNet Preprocessors using incorrect resolution and increased maximum of smallest dimension to 16384
1921
- Fixed Triton/Sage install option showing for incompatible GPUs

StabilityMatrix.Avalonia/ViewModels/CheckpointBrowser/CheckpointBrowserCardViewModel.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
using StabilityMatrix.Core.Models.Api;
2828
using StabilityMatrix.Core.Models.Database;
2929
using StabilityMatrix.Core.Models.FileInterfaces;
30-
using StabilityMatrix.Core.Models.Progress;
3130
using StabilityMatrix.Core.Processes;
3231
using StabilityMatrix.Core.Services;
3332

@@ -267,7 +266,7 @@ private async Task ShowVersionDialog(CivitModel model)
267266
.Where(v => !settingsManager.Settings.HideEarlyAccessModels || !v.IsEarlyAccess)
268267
.Select(version => new ModelVersionViewModel(modelIndexService, version))
269268
.ToImmutableArray();
270-
viewModel.SelectedVersionViewModel = viewModel.Versions[0];
269+
viewModel.SelectedVersionViewModel = viewModel.Versions.Any() ? viewModel.Versions[0] : null;
271270

272271
// Update with latest version (including files) if we have no files
273272
if (model.ModelVersions?.FirstOrDefault()?.Files is not { Count: > 0 })
@@ -312,7 +311,9 @@ private async Task ShowVersionDialog(CivitModel model)
312311
.Where(v => !settingsManager.Settings.HideEarlyAccessModels || !v.IsEarlyAccess)
313312
.Select(version => new ModelVersionViewModel(modelIndexService, version))
314313
.ToImmutableArray();
315-
viewModel.SelectedVersionViewModel = viewModel.Versions[0];
314+
viewModel.SelectedVersionViewModel = viewModel.Versions.Any()
315+
? viewModel.Versions[0]
316+
: null;
316317
});
317318

318319
// Save to db

StabilityMatrix.Avalonia/ViewModels/CheckpointsPageViewModel.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ private async Task ShowCivitVersionDialog(CheckpointFileViewModel item)
673673
viewModel.Versions = versions
674674
.Select(version => new ModelVersionViewModel(modelIndexService, version))
675675
.ToImmutableArray();
676-
viewModel.SelectedVersionViewModel = viewModel.Versions[0];
676+
viewModel.SelectedVersionViewModel = viewModel.Versions.Any() ? viewModel.Versions[0] : null;
677677

678678
dialog.Content = new SelectModelVersionDialog { DataContext = viewModel };
679679

@@ -1107,7 +1107,7 @@ private void RefreshCategories()
11071107
previouslySelectedCategory
11081108
?? Categories.FirstOrDefault(x => x.Path == previouslySelectedCategory?.Path)
11091109
?? Categories.FirstOrDefault()
1110-
?? categoriesCache.Items[0];
1110+
?? (categoriesCache.Items.Any() ? categoriesCache.Items[0] : null);
11111111

11121112
var dirPath = new DirectoryPath(SelectedCategory.Path);
11131113

@@ -1128,7 +1128,7 @@ private void RefreshCategories()
11281128
previouslySelectedCategory
11291129
?? Categories.FirstOrDefault(x => x.Path == previouslySelectedCategory?.Path)
11301130
?? Categories.FirstOrDefault()
1131-
?? categoriesCache.Items[0];
1131+
?? (categoriesCache.Items.Any() ? categoriesCache.Items[0] : null);
11321132
});
11331133
}
11341134

StabilityMatrix.Core/Models/Api/CivitModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,5 @@ public FileSizeType FullFilesSize
7070
ModelVersions is { Count: > 0 }
7171
? ModelVersions[0].PublishedAt ?? DateTimeOffset.MinValue
7272
: DateTimeOffset.MinValue
73-
).ToString("M/d/yy");
73+
).ToString("d", System.Globalization.CultureInfo.CurrentCulture);
7474
}

0 commit comments

Comments
 (0)