Fix input validation in StartScriptCreator

coverity_scan
Rob Cutmore 9 years ago
parent b93b97575e
commit fbca094dda

@ -75,27 +75,15 @@ std::string CSVWorld::StartScriptCreator::getErrors() const
std::string errors; std::string errors;
if (scriptId.empty()) if (scriptId.empty())
{ {
if (!errors.empty()) errors = "No Script ID entered";
{
errors += "<br>";
}
errors += "No Script ID entered";
} }
else if (getData().getScripts().searchId(scriptId) == -1) else if (getData().getScripts().searchId(scriptId) == -1)
{ {
if (!errors.empty()) errors = "Script ID not found";
{
errors += "<br>";
}
errors += "Script ID not found";
} }
else if (getData().getStartScripts().searchId(scriptId) > -1) else if (getData().getStartScripts().searchId(scriptId) > -1)
{ {
if (!errors.empty()) errors = "Script with this ID already registered as Start Script";
{
errors += "<br>";
}
errors += "Script with this ID already registered as Start Script";
} }
return errors; return errors;

@ -50,7 +50,7 @@ namespace CSVWorld
const std::string& originId, const std::string& originId,
const CSMWorld::UniversalId::Type type); const CSMWorld::UniversalId::Type type);
/// \return Formatted error descriptions for current user input. /// \return Error description for current user input.
virtual std::string getErrors() const; virtual std::string getErrors() const;
/// \brief Set focus to script ID input widget. /// \brief Set focus to script ID input widget.

Loading…
Cancel
Save