mirror of
https://github.com/EQEmu/Server.git
synced 2026-02-13 22:22:25 +00:00
[Hotfix] Instance GetUnusedInstanceID crash fox
This commit is contained in:
parent
7122ac33b2
commit
5d133a2b47
@ -138,7 +138,7 @@ bool Database::GetUnusedInstanceID(uint16 &instance_id)
|
|||||||
instance_id = 0;
|
instance_id = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// initial query - get max unused id above reserved
|
// initial query - get max unused id above reserved
|
||||||
auto query = fmt::format(
|
auto query = fmt::format(
|
||||||
"SELECT IFNULL(MAX(id), {}) + 1 FROM instance_list WHERE id > {}",
|
"SELECT IFNULL(MAX(id), {}) + 1 FROM instance_list WHERE id > {}",
|
||||||
@ -174,12 +174,12 @@ bool Database::GetUnusedInstanceID(uint16 &instance_id)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto row = results.begin();
|
for (auto row : results) {
|
||||||
|
// check that id is within limits
|
||||||
// check that id is within limits
|
if (row[0] && Strings::ToInt(row[0]) <= max_instance_id) {
|
||||||
if (Strings::ToInt(row[0]) <= max_instance_id) {
|
instance_id = Strings::ToInt(row[0]);
|
||||||
instance_id = Strings::ToInt(row[0]);
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// unhandled situation - should not reach here
|
// unhandled situation - should not reach here
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user