Skip to content

Commit 8b3220c

Browse files
committed
Fix crash on login/logout?
1 parent 8c59e1b commit 8b3220c

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

CustomizePlus/Templates/TemplateEditorManager.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ internal bool EnableEditor(Template template)
138138
};
139139

140140
if (!Character.IsValid) //safeguard
141-
ChangeEditorCharacterInternal(_gameObjectService.GetCurrentPlayerActorIdentifier()); //will set EditorProfile.Character
141+
ChangeEditorCharacterInternal(_gameObjectService.GetCurrentPlayerActorIdentifier().CreatePermanent()); //will set EditorProfile.Character
142142

143143
EditorProfile.Templates.Clear(); //safeguard
144144
EditorProfile.Templates.Add(CurrentlyEditedTemplate);
@@ -335,6 +335,8 @@ private void OnLogin()
335335
return;
336336
}
337337

338+
localPlayer = localPlayer.CreatePermanent();
339+
338340
if (_configuration.EditorConfiguration.PreviewCharacter != localPlayer)
339341
{
340342
_logger.Debug("Resetting editor character because automatic condition triggered in OnLogin");

CustomizePlus/UI/Windows/MainWindow/Tabs/Profiles/ProfilePanel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ private void DrawAddCharactersArea()
276276
if (ImGuiUtil.DrawDisabledButton("Apply to mannequin", buttonWidth, string.Empty, !_actorAssignmentUi.CanSetMannequin))
277277
_manager.AddCharacter(_selector.Selected!, _actorAssignmentUi.MannequinIdentifier);
278278

279-
var currentPlayer = _actorManager.GetCurrentPlayer();
279+
var currentPlayer = _actorManager.GetCurrentPlayer().CreatePermanent();
280280
if (ImGuiUtil.DrawDisabledButton("Apply to current character", buttonWidth, string.Empty, !currentPlayer.IsValid))
281281
_manager.AddCharacter(_selector.Selected!, currentPlayer);
282282

CustomizePlus/UI/Windows/MainWindow/Tabs/Templates/BoneEditorPanel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public void Draw()
144144
if (ImGuiUtil.DrawDisabledButton("Apply to mannequin", buttonWidth, string.Empty, !_actorAssignmentUi.CanSetMannequin))
145145
_editorManager.ChangeEditorCharacter(_actorAssignmentUi.MannequinIdentifier);
146146

147-
var currentPlayer = _gameObjectService.GetCurrentPlayerActorIdentifier();
147+
var currentPlayer = _gameObjectService.GetCurrentPlayerActorIdentifier().CreatePermanent();
148148
if (ImGuiUtil.DrawDisabledButton("Apply to current character", buttonWidth, string.Empty, !currentPlayer.IsValid))
149149
_editorManager.ChangeEditorCharacter(currentPlayer);
150150

0 commit comments

Comments
 (0)