mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
CLEANUP: Actually check the record in question is a topic when using addTopic
This commit is contained in:
parent
8565d0ab6c
commit
2e93b982f3
1 changed files with 7 additions and 3 deletions
|
@ -201,11 +201,15 @@ namespace MWLua
|
|||
verifyPlayer(player);
|
||||
|
||||
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(
|
||||
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);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue