summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mg_db.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/mg_db.c b/mg_db.c
index a062c7b..2fb4f99 100644
--- a/mg_db.c
+++ b/mg_db.c
@@ -71,9 +71,10 @@ mgSQLString::Init(const char* s)
m_original = strdup(s);
char *p=strrchr(m_original,' ');
- if (p+1 == strchr(m_original,0))
- while (p>=m_original && *p==' ')
- *p-- = 0;
+ if (p)
+ if (p+1 == strchr(m_original,0))
+ while (p>=m_original && *p==' ')
+ *p-- = 0;
#ifdef HAVE_SQLITE
m_str = new mgSQLStringSQLite(m_original);