From 8313f00fb3e4babb15918c665b887366e3535fea Mon Sep 17 00:00:00 2001 From: eidheim Date: Tue, 21 Jul 2015 14:00:58 +0200 Subject: [PATCH] Minor fix to crash when no methods existed in a c++ file. --- juci/selectiondialog.h | 2 +- juci/source.cc | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/juci/selectiondialog.h b/juci/selectiondialog.h index 7afad0e..d55d9a3 100644 --- a/juci/selectiondialog.h +++ b/juci/selectiondialog.h @@ -14,7 +14,7 @@ public: virtual void hide(); virtual void move(); - std::map > rows; //TODO: remove, instead add on_select + std::map > rows; //TODO: remove, instead add on_select. Also remember to destroy start_mark in destructor std::function on_hide; bool shown=false; Glib::RefPtr start_mark; diff --git a/juci/source.cc b/juci/source.cc index 17c4937..d2c7804 100644 --- a/juci/source.cc +++ b/juci/source.cc @@ -814,7 +814,10 @@ Source::ClangViewAutocomplete(file_path, project_path), selection_dialog(*this) selection_dialog.start_mark=get_buffer()->create_mark(get_buffer()->get_insert()->get_iter()); std::map > rows; selection_dialog.init(); - for(auto &method: clang_tokens->get_cxx_methods()) { + auto methods=clang_tokens->get_cxx_methods(); + if(methods.size()==0) + return; + for(auto &method: methods) { rows[method.first]=std::pair(std::to_string(method.second), ""); selection_dialog.append(method.first); }