iwongu / sqlite3pp

SQLite3++ - C++ wrapper of SQLite3 API
MIT License
609 stars 177 forks source link

query::rows::get(...) implementation for std::string type crashes on NULL #48

Closed ediap closed 7 years ago

ediap commented 7 years ago

In case when returned "const char*" value points to nullptr, the following implementation crashes. Is this expected implementation and the client code is requested to not use this wrapper for possible NULL values?

  std::string query::rows::get(int idx, std::string) const
  {
    return get(idx, (char const*)0);
  }
iwongu commented 7 years ago

Yes, if it can be NULL, please use char const* version instead of string one.