[libgda] Virtual connection: added check instead of crash



commit 636087501504347c12bf540df5df195d36673ff7
Author: Vivien Malerba <malerba gnome-db org>
Date:   Tue May 24 23:10:09 2011 +0200

    Virtual connection: added check instead of crash

 libgda/sqlite/virtual/gda-vprovider-data-model.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/libgda/sqlite/virtual/gda-vprovider-data-model.c b/libgda/sqlite/virtual/gda-vprovider-data-model.c
index c73782e..bf5b330 100644
--- a/libgda/sqlite/virtual/gda-vprovider-data-model.c
+++ b/libgda/sqlite/virtual/gda-vprovider-data-model.c
@@ -416,7 +416,11 @@ virtualCreate (sqlite3 *db, void *pAux, int argc, const char *const *argv, sqlit
 
 	td = gda_vconnection_get_table_data_by_unique_name (cnc, spec_name);
 	g_free (spec_name);
-	g_assert (td);
+	if (!td) {
+		/* wrong usage! */
+		*pzErr = SQLITE3_CALL (sqlite3_mprintf) (_("Wrong usage of Libgda's virtual tables"));
+		return SQLITE_ERROR;
+	}
 
 	/* preparations */
 	if (td->spec->data_model) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]