mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-05 15:22:37 +00:00
Use SQL to fix null
This commit is contained in:
parent
c2ab2a232b
commit
1084b71d8d
@ -404,11 +404,11 @@ bool SharedTaskManager::LoadSharedTaskState()
|
|||||||
// But the crash case may actually dictate we should :P
|
// But the crash case may actually dictate we should :P
|
||||||
|
|
||||||
// set next_id to highest used ID
|
// set next_id to highest used ID
|
||||||
query = "SELECT MAX(id) FROM shared_task_state";
|
query = "SELECT IFNULL(MAX(id), 0) FROM shared_task_state";
|
||||||
results = database.QueryDatabase(query);
|
results = database.QueryDatabase(query);
|
||||||
if (results.Success() && results.RowCount() == 1) {
|
if (results.Success() && results.RowCount() == 1) {
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
next_id = row[0] ? atoi(row[0]) : 0;
|
next_id = atoi(row[0]);
|
||||||
} else {
|
} else {
|
||||||
next_id = 0; // oh well
|
next_id = 0; // oh well
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user