Skip to content

Commit 5b246a2

Browse files
FoxWorn3365iamalexrouselouis1706
authored
fix: [EXILED::Events] Fixed the ChangingRoleAndSpawned.ChangeInventory NullReferenceException skill issue (#172)
* loader updoot & removed unused using * Update EXILED/Exiled.Loader/Loader.cs Suggestion #1 Co-authored-by: Alex Rouse <123724383+ALEXWARELLC@users.noreply.github.com> * Update EXILED/Exiled.Loader/Loader.cs Co-authored-by: Alex Rouse <123724383+ALEXWARELLC@users.noreply.github.com> * moved method private methods should be defined after public ones * updoot exiled kill sissues Co-authored-by: Alex Rouse <123724383+ALEXWARELLC@users.noreply.github.com> * updoot exiled kill sissues Co-authored-by: Alex Rouse <123724383+ALEXWARELLC@users.noreply.github.com> * updoot exiled kill sissues Co-authored-by: Alex Rouse <123724383+ALEXWARELLC@users.noreply.github.com> * updoot * fixed the infamous error * rollback - not same pr * big update!!!!! --------- Co-authored-by: Alex Rouse <123724383+ALEXWARELLC@users.noreply.github.com> Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com>
1 parent 92d7f68 commit 5b246a2

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

EXILED/Exiled.Events/Patches/Events/Player/ChangingRoleAndSpawned.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,10 @@ private static void ChangeInventory(ChangingRoleEventArgs ev)
186186
{
187187
try
188188
{
189-
if (!NetworkServer.active || ev == null || !ev.SpawnFlags.HasFlag(RoleSpawnFlags.AssignInventory))
189+
if (ev is null)
190+
return;
191+
192+
if (ev.ShouldPreserveInventory || ev.Reason == API.Enums.SpawnReason.Destroyed)
190193
return;
191194

192195
Inventory inventory = ev.Player.Inventory;

EXILED/Exiled.Loader/Loader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,4 +662,4 @@ private static void LoadDependencies()
662662
}
663663
}
664664
}
665-
}
665+
}

0 commit comments

Comments
 (0)