<p></p>
<p>Okay, I found a fix for this.</p>
<p>Swapping an active hero and a reserve hero means that you end up with a reserve hero's slice parented to the hero layer, and a active hero's slice parented to the reserve layer.</p>
<p>This normally doesn't matter, and gets fixed every tick when sorting the heroes for drawing.</p>
<p>But it matters if a change of map happens in the same tick as a hero swap, because in that case, the code that preserves the active heroes from deletion when recreating the hero layer misses one, because it is still parented to the reserve layer even though it belongs to an active hero now</p>
<p>At least I THINK that was what was happening, :D</p>
<p>At any rate, this does fix the crash for me.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/ohrrpgce/ohrrpgce/issues/1137#issuecomment-830984472">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AMWGWZR4U44EZHUE6GAIC63TLX6ZRANCNFSM4O7TTNZA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AMWGWZSTUKEUAY2HAEHJ5XLTLX6ZRA5CNFSM4O7TTNZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOGGD5CGA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/ohrrpgce/ohrrpgce/issues/1137#issuecomment-830984472",
"url": "https://github.com/ohrrpgce/ohrrpgce/issues/1137#issuecomment-830984472",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>