mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-14 12:51:07 +00:00
Handle the case of no rows returned in fuh::db_query_to_string
This commit is contained in:
parent
8714ece259
commit
6883f73c0f
@ -265,6 +265,8 @@ fuh::mysql_result fuh::db_query(const std::string& sql) {
|
||||
std::string fuh::db_query_to_string(const std::string& sql) {
|
||||
mysql_result res = db_query(sql);
|
||||
MYSQL_ROW row = mysql_fetch_row(res.get());
|
||||
if(row == NULL)
|
||||
throw error("query returned no rows");
|
||||
if(row[0] == NULL)
|
||||
throw error("got null value from the database");
|
||||
return std::string(row[0]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user