[Bug Fix] Fix null pointer crash on zones that have not booted a zone yet with #reload commands or anything that calls GetZoneDescription (#2231)

This commit is contained in:
Chris Miles 2022-05-31 20:55:00 -05:00 committed by GitHub
parent 162d34e1d9
commit 291aaea581
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,6 +60,7 @@
#include "../common/repositories/criteria/content_filter_criteria.h"
#include "../common/repositories/content_flags_repository.h"
#include "../common/repositories/zone_points_repository.h"
#include "../common/serverinfo.h"
#include <time.h>
#include <ctime>
@ -723,7 +724,7 @@ void Zone::GetMerchantDataForZoneLoad() {
if (found) {
continue;
}
mle.slot = std::stoul(row[1]);
mle.item = std::stoul(row[2]);
mle.faction_required = static_cast<int16>(std::stoi(row[3]));
@ -2734,6 +2735,14 @@ uint32 Zone::GetCurrencyItemID(uint32 currency_id)
std::string Zone::GetZoneDescription()
{
if (!IsLoaded()) {
return fmt::format(
"{} PID ({})",
IsStaticZone() ? "Static" : "Dynamic",
EQ::GetPID()
);
}
auto d = fmt::format(
"{} ({}){}{}",
GetLongName(),