Stop segfaulting when export schema file name is not set.

This commit is contained in:
Nirgal
2011-08-10 18:00:18 -04:00
committed by Brian Bruns
parent 457b5a77ec
commit 49a395b3c6

View File

@@ -27,7 +27,6 @@ extern MdbHandle *mdb;
GladeXML *schemawin_xml; GladeXML *schemawin_xml;
static gchar backend[100]; static gchar backend[100];
static gchar tabname[MDB_MAX_OBJ_NAME+1]; static gchar tabname[MDB_MAX_OBJ_NAME+1];
static gchar file_path[PATH_MAX+1];
static guint32 export_options; static guint32 export_options;
#define ALL_TABLES "(All Tables)" #define ALL_TABLES "(All Tables)"
@@ -47,7 +46,7 @@ static struct {
#define n_capabilities (sizeof(capabilities_xlt)/sizeof(capabilities_xlt[0])) #define n_capabilities (sizeof(capabilities_xlt)/sizeof(capabilities_xlt[0]))
static void static void
gmdb_schema_export() gmdb_schema_export(const gchar *file_path)
{ {
FILE *outfile; FILE *outfile;
@@ -77,13 +76,13 @@ void
gmdb_schema_export_cb(GtkWidget *w, gpointer data) gmdb_schema_export_cb(GtkWidget *w, gpointer data)
{ {
GtkWidget *schemawin, *combo, *checkbox, *chooser; GtkWidget *schemawin, *combo, *checkbox, *chooser;
gchar *file_path;
int i; int i;
schemawin = glade_xml_get_widget (schemawin_xml, "schema_dialog"); schemawin = glade_xml_get_widget (schemawin_xml, "schema_dialog");
chooser = glade_xml_get_widget (schemawin_xml, "filechooserbutton1"); chooser = glade_xml_get_widget (schemawin_xml, "filechooserbutton1");
strncpy(file_path,gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser)),PATH_MAX); file_path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser));
file_path[PATH_MAX]=0;
combo = glade_xml_get_widget (schemawin_xml, "table_combo"); combo = glade_xml_get_widget (schemawin_xml, "table_combo");
strncpy(tabname,gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(combo)->entry)),MDB_MAX_OBJ_NAME); strncpy(tabname,gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(combo)->entry)),MDB_MAX_OBJ_NAME);
@@ -112,7 +111,7 @@ int i;
//printf("%s %s %02X\n",tabname,backend,export_options); //printf("%s %s %02X\n",tabname,backend,export_options);
gtk_widget_destroy(schemawin); gtk_widget_destroy(schemawin);
gmdb_schema_export(); gmdb_schema_export(file_path);
} }
static void static void
check_default_options() { check_default_options() {