1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

fix crash with custom campaign preview

This commit is contained in:
Laserlicht 2023-10-11 11:23:38 +02:00 committed by GitHub
parent 3f3c079c0e
commit abab917ef9
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