diff options
author | Sebastian Schmelzer | 2009-02-20 20:05:35 +0100 |
---|---|---|
committer | Sebastian Schmelzer | 2009-02-20 20:05:35 +0100 |
commit | ec406db06a0c86a7cf801bf6593ef20a7d689a34 (patch) | |
tree | 5d5d77c138a9818414146052a5a730ad93779cd0 | |
parent | vmchooser source: * added feature to save last session and choose it again ne... (diff) | |
download | vmchooser-ec406db06a0c86a7cf801bf6593ef20a7d689a34.tar.gz vmchooser-ec406db06a0c86a7cf801bf6593ef20a7d689a34.tar.xz vmchooser-ec406db06a0c86a7cf801bf6593ef20a7d689a34.zip |
* fix for segfault if no .vmchooser is found ..
git-svn-id: http://svn.openslx.org/svn/openslx/openslx-src-tools/vmchooser/trunk@2625 95ad53e4-c205-0410-b2fa-d234c58c8868
-rw-r--r-- | vmchooser/SWindow.cxx | 25 | ||||
-rw-r--r-- | vmchooser/userSession.cxx | 4 |
2 files changed, 20 insertions, 9 deletions
diff --git a/vmchooser/SWindow.cxx b/vmchooser/SWindow.cxx index a3ec373..b08b224 100644 --- a/vmchooser/SWindow.cxx +++ b/vmchooser/SWindow.cxx @@ -5,6 +5,8 @@ #include <iostream> #include <map> +#include <string.h> + #include <img/gnome_32.xpm> #include <img/kde_32.xpm> #include <img/linux_32.xpm> @@ -204,16 +206,21 @@ void SWindow::unfold_entries() { //sel.indented(false); char* prename = readSession(); - sel.goto_index(0); - Item* it = (Item*) sel.next(); - - while( it ) { - if(! strcmp(prename,it->label()) ) { - sel.select_only_this(0); - curr = it; - return; + if ( prename == NULL ) { + return; + } else { + printf("readsesseion returned: %s", prename); + sel.goto_index(0); + Item* it = (Item*) sel.next(); + + while( it ) { + if(! strcmp(prename,it->label()) ) { + sel.select_only_this(0); + curr = it; + return; + } + it = (Item*) sel.next(); } - it = (Item*) sel.next(); } } diff --git a/vmchooser/userSession.cxx b/vmchooser/userSession.cxx index af11d4b..9f0edaa 100644 --- a/vmchooser/userSession.cxx +++ b/vmchooser/userSession.cxx @@ -59,6 +59,10 @@ char* readSession() { // read presaved session with ifstream ifstream fin(fname.c_str()); + if (!fin) { + cout << ".vmchooser file not found .. continue with global default" << endl; + return NULL; + } string sessname; getline(fin,sessname); char* blub = (char*) malloc(sessname.size()); |