diff examples/menu/filebrowser.c @ 329:740844ee48c4

Update position of light-bar after update menu item
author Thinker K.F. Li <thinker@branda.to>
date Fri, 06 Mar 2009 20:39:25 +0800
parents 4453ea44a83d
children ab7f3c00fd05
line wrap: on
line diff
--- a/examples/menu/filebrowser.c	Fri Mar 06 19:42:01 2009 +0800
+++ b/examples/menu/filebrowser.c	Fri Mar 06 20:39:25 2009 +0800
@@ -93,15 +93,16 @@
     struct fileinfo *f;
     int i;
 
-    if (data->curDir)
-	    free(data->curDir);
-    data->curDir = strdup(curdir);
     dir = opendir(curdir);
     if (dir == NULL) {
 	    printf("We can not open the direftory %s\n", curdir);
 	    return;
     }
 
+    if (data->curDir)
+	    free(data->curDir);
+    data->curDir = strdup(curdir);
+    
     if (data->files) {
 	    for(i=0;i<data->nFiles;i++) {
 		    fileinfo_free(data->files[i]);