Fix Coverity divide-by-zero warning
Closes CID 1380221 Instead of assert() throw an exception explaining what went wrong.
This commit is contained in:
parent
c6f523f8cd
commit
7c3d789514
1 changed files with 5 additions and 1 deletions
|
@ -350,7 +350,11 @@ void display::init_flags_for_side_internal(size_t n, const std::string& side_col
|
|||
animated<image::locator>& f = flags_[n];
|
||||
|
||||
f = temp_anim;
|
||||
assert(f.get_end_time() != 0);
|
||||
if (f.get_end_time() <= 0) {
|
||||
std::stringstream msg;
|
||||
msg << "Invalid animation duration (<= 0) found when constructing flag for side " << n;
|
||||
throw std::domain_error(msg.str());
|
||||
}
|
||||
f.start_animation(rand() % f.get_end_time(), true);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue