mirror of
https://github.com/OpenMW/openmw.git
synced 2025-12-13 00:43:05 +00:00
CLEANUP: Actually check the record in question is a topic when using addTopic
This commit is contained in:
parent
05b12ac879
commit
8ec4fcbf30
1 changed files with 7 additions and 3 deletions
|
|
@ -201,11 +201,15 @@ namespace MWLua
|
||||||
verifyPlayer(player);
|
verifyPlayer(player);
|
||||||
|
|
||||||
ESM::RefId topic = ESM::RefId::deserializeText(topicId);
|
ESM::RefId topic = ESM::RefId::deserializeText(topicId);
|
||||||
if (!MWBase::Environment::get().getESMStore()->get<ESM::Dialogue>().search(topic))
|
const ESM::Dialogue* dialogueRecord
|
||||||
{
|
= MWBase::Environment::get().getESMStore()->get<ESM::Dialogue>().search(topic);
|
||||||
|
|
||||||
|
if (!dialogueRecord)
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
Misc::StringUtils::format("Failed to add topic ", topicId, ": topic record not found"));
|
Misc::StringUtils::format("Failed to add topic ", topicId, ": topic record not found"));
|
||||||
}
|
else if (dialogueRecord->mType != ESM::Dialogue::Topic)
|
||||||
|
throw std::runtime_error(
|
||||||
|
Misc::StringUtils::format("Failed to add topic ", topicId, ": record is not a topic"));
|
||||||
|
|
||||||
MWBase::Environment::get().getDialogueManager()->addTopic(topic);
|
MWBase::Environment::get().getDialogueManager()->addTopic(topic);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue