From eb75f79b70ccea775a376683709b6bb912b847cc Mon Sep 17 00:00:00 2001
From: Leon Styhre <leon@leonstyhre.com>
Date: Sun, 23 Jun 2024 21:41:53 +0200
Subject: [PATCH] Game files with only an extension and no filename will now
 get skipped on application startup

---
 es-app/src/SystemData.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/es-app/src/SystemData.cpp b/es-app/src/SystemData.cpp
index 81c340a17..fbfb37c66 100644
--- a/es-app/src/SystemData.cpp
+++ b/es-app/src/SystemData.cpp
@@ -349,6 +349,12 @@ bool SystemData::populateFolder(FileData* folder)
             !(isDirectory && extension == ".")) {
             FileData* newGame {new FileData(GAME, filePath, mEnvData, this)};
 
+            if (newGame->metadata.get("name") == "") {
+                LOG(LogWarning) << "Skipped \"" << filePath << "\" as it has no filename";
+                delete newGame;
+                continue;
+            }
+
             // If adding a configured file extension to a directory it will get interpreted as
             // a regular file. This is useful for displaying multi-file/multi-disc games as single
             // entries or for emulators that can get directories passed to them as command line