Address potential crash if a storyscreen has no showable parts
This commit is contained in:
parent
1299998a6f
commit
a141de5e53
2 changed files with 7 additions and 2 deletions
|
@ -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:
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
|
||||
part_pointer_type get_part(int index) const
|
||||
{
|
||||
return parts_[index];
|
||||
return parts_.at(index);
|
||||
}
|
||||
|
||||
int max_parts() const
|
||||
|
|
Loading…
Add table
Reference in a new issue