summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vmchooser/SWindow.cxx25
-rw-r--r--vmchooser/userSession.cxx4
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());