Skip to content

Commit

Permalink
Fix NRE throw when featured icon doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
neon-nyan committed Nov 24, 2024
1 parent c9cd14d commit 4dcd012
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions CollapseLauncher/XAMLs/MainApp/Pages/HomePage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,10 @@ private async void TryLoadEventPanelImage()
string featuredEventIconImg = LauncherMetadataHelper.CurrentMetadataConfig?.GameLauncherApi?
.LauncherGameNews?.Content?.Background?.FeaturedEventIconBtnImg;

// If the region event panel property is null, then return
if (string.IsNullOrEmpty(featuredEventIconImg)
|| string.IsNullOrEmpty(featuredEventArticleUrl)) return;

if (!_eventPanelProcessing.TryAdd(featuredEventArticleUrl, 0) ||
!_eventPanelProcessing.TryAdd(featuredEventIconImg, 0))
{
Expand All @@ -313,9 +317,6 @@ private async void TryLoadEventPanelImage()
return;
}

// If the region event panel property is null, then return
if (string.IsNullOrEmpty(featuredEventIconImg)) return;

// Get the cached filename and path
string cachedFileHash = BytesToCRC32Simple(featuredEventIconImg);
string cachedFilePath = Path.Combine(AppGameImgCachedFolder, cachedFileHash);
Expand Down

0 comments on commit 4dcd012

Please sign in to comment.