Address potential crash if a storyscreen has no showable parts

This commit is contained in:
Celtic Minstrel 2017-05-21 16:45:11 -04:00
parent 1299998a6f
commit a141de5e53
2 changed files with 7 additions and 2 deletions

View file

@ -37,7 +37,12 @@ public:
static void display(const std::string& scenario_name, const config& story, CVideo& video)
{
story_viewer(scenario_name, story).show(video);
if(!story.has_child("part")) {
return;
}
try {
story_viewer(scenario_name, story).show(video);
} catch(std::out_of_range&) {}
}
private:

View file

@ -39,7 +39,7 @@ public:
part_pointer_type get_part(int index) const
{
return parts_[index];
return parts_.at(index);
}
int max_parts() const