fix: crash with menus and commands (resolves #292)

This commit is contained in:
jeefo 2023-02-02 16:52:28 +03:00
commit 84c2794aed
No known key found for this signature in database
GPG key ID: D85B0637366787C3
2 changed files with 13 additions and 0 deletions

View file

@ -244,6 +244,11 @@ CR_EXPORT int GetEntityAPI (gamefuncs_t *table, int) {
graph.setEditor (nullptr);
}
// clear issuer for the menus and commands
if (ent == ctrl.getIssuer ()) {
ctrl.setIssuer (nullptr);
}
if (game.is (GameFlags::Metamod)) {
RETURN_META (MRES_IGNORED);
}
@ -344,6 +349,10 @@ CR_EXPORT int GetEntityAPI (gamefuncs_t *table, int) {
// send message on new map
util.setNeedForWelcome (false);
// clear local entity
game.setLocalEntity (nullptr);
// reset graph state
graph.reset ();
// clear all the bots