diff --git a/soh/soh/Enhancements/randomizer/dungeon.cpp b/soh/soh/Enhancements/randomizer/dungeon.cpp index 103f984618..d52b6fcb7f 100644 --- a/soh/soh/Enhancements/randomizer/dungeon.cpp +++ b/soh/soh/Enhancements/randomizer/dungeon.cpp @@ -99,6 +99,10 @@ RandomizerSettingKey DungeonInfo::GetMQSetting() const { } int8_t FindUsedSmallKeys(const SaveContext* saveContext, const SceneID scene, const std::vector* DoorFlags) { + if (DoorFlags == nullptr) { + return 0; + } + // Get the swch value for the scene uint32_t swch; if (gPlayState != nullptr && gPlayState->sceneNum == scene) { diff --git a/soh/soh/Enhancements/randomizer/logic.cpp b/soh/soh/Enhancements/randomizer/logic.cpp index 7c199b43a4..43173c5345 100644 --- a/soh/soh/Enhancements/randomizer/logic.cpp +++ b/soh/soh/Enhancements/randomizer/logic.cpp @@ -2699,7 +2699,11 @@ int8_t Logic::GetSmallKeyCount(SceneID sceneId) { return FindTotalSmallKeys(mSaveContext, SCENE_THIEVES_HIDEOUT, &DoorFlags); } - return Rando::Context::GetInstance()->GetDungeons()->GetDungeonFromScene(sceneId)->GetTotalSmallKeys(mSaveContext); + if (auto* dungeon = Rando::Context::GetInstance()->GetDungeons()->GetDungeonFromScene(sceneId)) { + return dungeon->GetTotalSmallKeys(mSaveContext); + } + + return FindTotalSmallKeys(mSaveContext, sceneId, nullptr); } void Logic::SetSmallKeyCount(uint32_t dungeonIndex, uint8_t count) {