Don't attempt to load an object that hasn't been listed yet by the provider

- Fixes issue when switching to a new product, product does not display the first time
This commit is contained in:
Dan Paulat 2023-06-18 22:34:29 -05:00
parent 7d74a0e312
commit ea1569cb76
2 changed files with 18 additions and 9 deletions

View file

@ -792,7 +792,16 @@ void RadarProductManagerImpl::LoadProviderData(
if (existingRecord == nullptr)
{
std::string key = providerManager->provider_->FindKey(time);
nexradFile = providerManager->provider_->LoadObjectByKey(key);
if (!key.empty())
{
nexradFile = providerManager->provider_->LoadObjectByKey(key);
}
else
{
logger_->warn("Attempting to load object without key: {}",
scwx::util::TimeString(time));
}
}
else
{
@ -1042,7 +1051,7 @@ RadarProductManagerImpl::GetLevel2ProductRecord(
record = recordPtr->second.lock();
}
if (record == nullptr &&
if (recordPtr != nullptr && record == nullptr &&
recordTime != std::chrono::system_clock::time_point {})
{
// Product is expired, reload it
@ -1107,7 +1116,7 @@ RadarProductManagerImpl::GetLevel3ProductRecord(
}
}
if (record == nullptr &&
if (recordPtr != nullptr && record == nullptr &&
recordTime != std::chrono::system_clock::time_point {})
{
// Product is expired, reload it