Permalink
Browse files

Escape without a connection no longer throws a segmentation fault

  • Loading branch information...
mariano committed May 12, 2012
1 parent e42d003 commit f1275ab0bcfb9f08853ec240dc4b6afc03de5624
Showing with 5 additions and 1 deletion.
  1. +1 −1 lib/node-db
  2. +4 −0 src/connection.cc
Submodule node-db updated 4 files
+11 −17 binding.cc
+2 −8 binding.h
+12 −18 query.cc
+2 −8 query.h
View
@@ -125,6 +125,10 @@ void node_db_mysql::Connection::close() {
}
std::string node_db_mysql::Connection::escape(const std::string& string) const throw(node_db::Exception&) {
+ if (!this->alive) {
+ throw node_db::Exception("Can\'t escape string without an active connection");
+ }
+
char* buffer = new char[string.length() * 2 + 1];
if (buffer == NULL) {
throw node_db::Exception("Can\'t create buffer to escape string");

0 comments on commit f1275ab

Please sign in to comment.