Commit 9592f107 authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström

Merge branch 'patches/bug10035'

* patches/bug10035:
  SQLite.ResObj: Survive sqlite3_column_name() returning NULL.
parents 2d995f33 88821b39
......@@ -295,6 +295,16 @@ PIKECLASS TypedResult
*/
PIKEFUN array(mapping(string:mixed)) fetch_fields() {
int i,t;
if (!sqlite3_column_name(THIS->stmt, 0)) {
/* Documented to happen on malloc() failure,
* but can apparently happen in other cases too.
* The common case seems to be when called after
* the last row has been fetched.
* Cf #10035.
*/
push_int(0);
return;
}
for(i=0; i<THIS->columns; i++) {
push_constant_text("name");
push_text(sqlite3_column_name(THIS->stmt, i));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment