--- expense/expense_conduit.c~	2005-07-20 10:36:35.000000000 -0400
+++ expense/expense_conduit.c	2005-07-20 11:20:30.000000000 -0400
@@ -244,10 +244,14 @@ static gint copy_from_pilot( GnomePilotC
 
         int i;
         int ret;
-        int filehandle[17];
+        const int numhandles = 17;
+        int filehandle[numhandles];
         int result = 0;
 
-        if(GET_CONDUIT_CFG(c)->dir==NULL) {
+        for (i = 0; i < numhandles; i++)
+                filehandle[i] = -1;
+
+        if(GET_CONDUIT_CFG(c)->dir==NULL || strlen(GET_CONDUIT_CFG(c)->dir)==0) {
 		g_warning(_("No dir specified. Please run expense conduit capplet first."));
 		gnome_pilot_conduit_send_error(c,
                                                _("No dir specified. Please run expense conduit capplet first."));
@@ -306,7 +310,7 @@ static gint copy_from_pilot( GnomePilotC
         }
         
         /* open one file for every category in Expense */
-        for(i = 0; i < 17; i++) {
+        for(i = 0; i < numhandles; i++) {
                 if(*tai->category.name[i] != '\0') {
                         LOG("Opening for cat %d: %s\n", i, category_path(i, c));
                         if((filehandle[i] = creat(category_path(i, c), GET_CONDUIT_CFG(c)->fileMode))== -1) {
@@ -343,7 +347,7 @@ static gint copy_from_pilot( GnomePilotC
         result = -1;
  exit:
         /* close all the opened filehandles */
-        for(i = 0; i < 17; i++)
+        for(i = 0; i < numhandles; i++)
                 if(filehandle[i] != -1)
                         close(filehandle[i]);
 
