diff options
author | glotov@chromium.org <glotov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-17 13:11:17 +0000 |
---|---|---|
committer | glotov@chromium.org <glotov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-17 13:11:17 +0000 |
commit | b4c363bad50f8f5733c7b10c232fb164ecc708b5 (patch) | |
tree | 23c432aab1db5188f309d057c4d5cebb7f2116fb /sql | |
parent | 269543e261505b409a45903151411fb51a7a1813 (diff) | |
download | chromium_src-b4c363bad50f8f5733c7b10c232fb164ecc708b5.zip chromium_src-b4c363bad50f8f5733c7b10c232fb164ecc708b5.tar.gz chromium_src-b4c363bad50f8f5733c7b10c232fb164ecc708b5.tar.bz2 |
Fixing null pointer dereference.
BUG=chromium:158178
TEST=units,make sure such SEGV doesnt happen on x86-generic-bot (where it pops periodically now)
Review URL: https://chromiumcodereview.appspot.com/11886065
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177399 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sql')
-rw-r--r-- | sql/connection.h | 5 | ||||
-rw-r--r-- | sql/statement.cc | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/sql/connection.h b/sql/connection.h index b9f45ec..2722ffd 100644 --- a/sql/connection.h +++ b/sql/connection.h @@ -370,8 +370,9 @@ class SQL_EXPORT Connection { // When true, the statement can be used. bool is_valid() const { return !!stmt_; } - // If we've not been linked to a connection, this will be NULL. Guaranteed - // non-NULL when is_valid(). + // If we've not been linked to a connection, this will be NULL. + // TODO(shess): connection_ can be NULL in case of GetUntrackedStatement(), + // which prevents Statement::OnError() from forwarding errors. Connection* connection() const { return connection_; } // Returns the sqlite statement if any. If the statement is not active, diff --git a/sql/statement.cc b/sql/statement.cc index 84dfd2e..cd55bf7 100644 --- a/sql/statement.cc +++ b/sql/statement.cc @@ -306,7 +306,7 @@ bool Statement::CheckOk(int err) const { int Statement::CheckError(int err) { // Please don't add DCHECKs here, OnSqliteError() already has them. succeeded_ = (err == SQLITE_OK || err == SQLITE_ROW || err == SQLITE_DONE); - if (!succeeded_ && is_valid()) + if (!succeeded_ && is_valid() && ref_->connection()) return ref_->connection()->OnSqliteError(err, this); return err; } |