1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2026-01-01 10:13:30 +00:00

Fix undo/redo crash when no layer element is selected

This commit is contained in:
SpoinkyNL 2020-01-14 21:31:12 +01:00
parent ae330c3769
commit 1a0e9a287a

View File

@ -88,11 +88,14 @@ namespace Artemis.UI.Services
_profileService.UndoUpdateProfile(SelectedProfile, module); _profileService.UndoUpdateProfile(SelectedProfile, module);
OnSelectedProfileChanged(); OnSelectedProfileChanged();
var elements = SelectedProfile.GetAllLayers().Cast<ProfileElement>().ToList(); if (SelectedProfileElement != null)
elements.AddRange(SelectedProfile.GetAllFolders()); {
var elements = SelectedProfile.GetAllLayers().Cast<ProfileElement>().ToList();
elements.AddRange(SelectedProfile.GetAllFolders());
var element = elements.FirstOrDefault(l => l.EntityId == SelectedProfileElement.EntityId);
ChangeSelectedProfileElement(element);
}
var element = elements.FirstOrDefault(l => l.EntityId == SelectedProfileElement.EntityId);
ChangeSelectedProfileElement(element);
UpdateProfilePreview(); UpdateProfilePreview();
} }
@ -101,11 +104,14 @@ namespace Artemis.UI.Services
_profileService.RedoUpdateProfile(SelectedProfile, module); _profileService.RedoUpdateProfile(SelectedProfile, module);
OnSelectedProfileChanged(); OnSelectedProfileChanged();
var elements = SelectedProfile.GetAllLayers().Cast<ProfileElement>().ToList(); if (SelectedProfileElement != null)
elements.AddRange(SelectedProfile.GetAllFolders()); {
var elements = SelectedProfile.GetAllLayers().Cast<ProfileElement>().ToList();
elements.AddRange(SelectedProfile.GetAllFolders());
var element = elements.FirstOrDefault(l => l.EntityId == SelectedProfileElement.EntityId);
ChangeSelectedProfileElement(element);
}
var element = elements.FirstOrDefault(l => l.EntityId == SelectedProfileElement.EntityId);
ChangeSelectedProfileElement(element);
UpdateProfilePreview(); UpdateProfilePreview();
} }