Fix crash with no film.
authorCarl Hetherington <cth@carlh.net>
Sat, 9 Aug 2014 14:50:33 +0000 (15:50 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 9 Aug 2014 14:50:33 +0000 (15:50 +0100)
src/wx/film_editor.cc

index 98d30a2a3b09abc1ba9669c96a95a4138d1254b2..d0534f9c06f873accb754622412840d6149c035a 100644 (file)
@@ -879,7 +879,10 @@ ContentList
 FilmEditor::selected_content ()
 {
        ContentList sel;
-       long int s = -1;
+
+       if (!_film) {
+               return sel;
+       }
 
        /* The list was populated using a sorted content list, so we must sort it here too
           so that we can look up by index and get the right thing.
@@ -887,6 +890,7 @@ FilmEditor::selected_content ()
        ContentList content = _film->content ();
        sort (content.begin(), content.end(), ContentSorter ());
        
+       long int s = -1;
        while (true) {
                s = _content->GetNextItem (s, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
                if (s == -1) {