]> git.tdb.fi Git - r2c2.git/commitdiff
Avoid crash in SlopeTool if nothing is selected
authorMikko Rasa <tdb@tdb.fi>
Sun, 4 May 2014 17:36:44 +0000 (20:36 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 4 May 2014 20:13:09 +0000 (23:13 +0300)
source/designer/slopetool.cpp

index d4a6ffb770f7b5fecd38b2b5c6e14544efa63e94..ef96e558d08f697dd9219c99629b2779583b517a 100644 (file)
@@ -9,6 +9,13 @@ SlopeTool::SlopeTool(Designer &d, Input::Keyboard &k, Input::Mouse &m, const set
        Tool(d, k, m),
        total_length(0)
 {
+       if(objects.empty())
+       {
+               set_status("Nothing selected");
+               set_done(false);
+               return;
+       }
+
        for(set<Object *>::const_iterator i=objects.begin(); i!=objects.end(); ++i)
                if(!dynamic_cast<Track *>(*i) || (*i)->get_n_link_slots()!=2)
                {