Skip to content

Commit

Permalink
Fixed null refs blocking compilation in Git
Browse files Browse the repository at this point in the history
  • Loading branch information
Piranha91 committed Jan 16, 2024
1 parent c7ec355 commit fe6b18d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion HappyCRappy/DTOs/LoadOrderBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ public class LoadOrderBlock
public List<ModKey> Mods { get; set; } = new();
public ModKey? PlaceAfter { get; set; }
public ModKey? PlaceBefore { get; set; }
public string Name { get; set; }
public string Name { get; set; } = string.Empty;
}
3 changes: 2 additions & 1 deletion HappyCRappy/UI/Menus/Load Order Menu/VM_LoadOrderBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public VM_LoadOrderBlock(VM_LoadOrderStash parentSnapshot, VM_LoadOrderMenu pare
canExecute: _ => true,
execute: x =>
{
if (x == null) { return; }
Mods.Remove((VM_ModKeyWrapper)x);
DeleteIfNecessary();
}
Expand Down Expand Up @@ -67,7 +68,7 @@ public VM_LoadOrderBlock(VM_LoadOrderStash parentSnapshot, VM_LoadOrderMenu pare
private readonly VM_LoadOrderMenu _parentMenu;
private readonly VM_LoadOrderStash _parentSnapshot;
private readonly VM_ModKeyWrapper.Factory _modWrapperFactory;
public string Name { get; set; }
public string Name { get; set; } = string.Empty;
public ObservableCollection<VM_ModKeyWrapper> Mods { get; set; } = new();
public VM_ModKeyWrapper? PlaceAfter { get; set; }
public ObservableCollection<VM_ModKeyWrapper> AvailablePriorMods { get; set; } = new();
Expand Down
8 changes: 5 additions & 3 deletions HappyCRappy/UI/Menus/Load Order Menu/VM_LoadOrderMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,11 @@ public VM_ModKeyWrapper(ModKey modKey, Func<VM_LoadOrderMenu> parentMenu)

public void RefreshAvailability()
{
if (_parentMenu().SelectedStash != null &&
_parentMenu().SelectedStash?.ModChunks != null &&
_parentMenu().SelectedStash.ModChunks.Where(x => x.Mods.Select(y => y.ModKey).Contains(ModKey)).Any())
var parentMenu = _parentMenu();
if (parentMenu != null &&
parentMenu.SelectedStash != null &&
parentMenu.SelectedStash?.ModChunks != null &&
parentMenu.SelectedStash.ModChunks.Where(x => x.Mods.Select(y => y.ModKey).Contains(ModKey)).Any())
{
IsManaged = true;
BorderColor = new(Colors.Gray);
Expand Down

0 comments on commit fe6b18d

Please sign in to comment.