From bcd8190516d3efb8bce0bfa49c25ce8f5d745379 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Thu, 13 May 2021 13:58:56 +0200 Subject: [PATCH] Fix a crash in aipackage.cpp --- components/esm/aipackage.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/components/esm/aipackage.cpp b/components/esm/aipackage.cpp index abbd2c62c..fa20d271c 100644 --- a/components/esm/aipackage.cpp +++ b/components/esm/aipackage.cpp @@ -15,7 +15,12 @@ namespace ESM { AIPackage pack; if (esm.retSubName() == AI_CNDT) { - mList.back().mCellName = esm.getHString(); + if (mList.empty()) + { + esm.fail("AIPackge with an AI_CNDT applying to no cell."); + } else { + mList.back().mCellName = esm.getHString(); + } } else if (esm.retSubName() == AI_Wander) { pack.mType = AI_Wander; esm.getHExact(&pack.mWander, 14);