From: Mikko Rasa Date: Sun, 4 May 2014 17:36:44 +0000 (+0300) Subject: Avoid crash in SlopeTool if nothing is selected X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=92c6b7a632cb6f380802114abcb4739fd0029261;p=r2c2.git Avoid crash in SlopeTool if nothing is selected --- diff --git a/source/designer/slopetool.cpp b/source/designer/slopetool.cpp index d4a6ffb..ef96e55 100644 --- a/source/designer/slopetool.cpp +++ b/source/designer/slopetool.cpp @@ -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::const_iterator i=objects.begin(); i!=objects.end(); ++i) if(!dynamic_cast(*i) || (*i)->get_n_link_slots()!=2) {