mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-15 02:31:47 +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) {
|
std::string fuh::db_query_to_string(const std::string& sql) {
|
||||||
mysql_result res = db_query(sql);
|
mysql_result res = db_query(sql);
|
||||||
MYSQL_ROW row = mysql_fetch_row(res.get());
|
MYSQL_ROW row = mysql_fetch_row(res.get());
|
||||||
|
if(row == NULL)
|
||||||
|
throw error("query returned no rows");
|
||||||
if(row[0] == NULL)
|
if(row[0] == NULL)
|
||||||
throw error("got null value from the database");
|
throw error("got null value from the database");
|
||||||
return std::string(row[0]);
|
return std::string(row[0]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user