Skip to content

Commit

Permalink
Fix bug #24477: Segfault when launching credits screen
Browse files Browse the repository at this point in the history
Guifixes introduced a regression where the code would try to iterate
over a pointer to a vector without checking if it was non-null. This
adds the check to ensure that it is non-null before attempting to
iterate.
  • Loading branch information
aginor committed Feb 29, 2016
1 parent 504ed49 commit 2a0631c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/show_dialog.cpp
Expand Up @@ -169,8 +169,10 @@ void dialog_frame::handle_event(const SDL_Event& event) {
if (event.type == DRAW_ALL_EVENT) {
set_dirty();

for(std::vector<button *>::iterator it = buttons_->begin(); it != buttons_->end(); ++it) {
(*it)->set_dirty(true);
if (buttons_) {
for(std::vector<button *>::iterator it = buttons_->begin(); it != buttons_->end(); ++it) {
(*it)->set_dirty(true);
}
}
}

Expand Down

0 comments on commit 2a0631c

Please sign in to comment.