1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Merge pull request #3042 from Laserlicht/crash_preview

[fix] crash with custom campaign preview
This commit is contained in:
Nordsoft91 2023-10-13 10:57:02 +02:00 committed by GitHub
commit 802e1bb961
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -149,7 +149,7 @@ CMapOverviewWidget::CMapOverviewWidget(CMapOverview& parent):
const JsonNode config(JsonPath::builtin("config/widgets/mapOverview.json"));
if(settings["lobby"]["mapPreview"].Bool())
if(settings["lobby"]["mapPreview"].Bool() && p.tabType != ESelectionScreen::campaignList)
{
ResourcePath res = ResourcePath(p.resource.getName(), EResType::MAP);
std::unique_ptr<CMap> campaignMap = nullptr;
@ -192,7 +192,7 @@ CMapOverviewWidget::CMapOverviewWidget(CMapOverview& parent):
{
if(p.date.empty())
{
std::time_t time = boost::filesystem::last_write_time(*CResourceHandler::get()->getResourceName(ResourcePath(p.resource.getName(), EResType::MAP)));
std::time_t time = boost::filesystem::last_write_time(*CResourceHandler::get()->getResourceName(ResourcePath(p.resource.getName(), p.tabType == ESelectionScreen::campaignList ? EResType::CAMPAIGN : EResType::MAP)));
w->setText(vstd::getFormattedDateTime(time));
}
else