Minor remaining fixes for PR (#4374)

- changed case of `handleNoModLoader` to match project style

- made default case in switch statement for `handleNoModLoader` return
  true for safety

Signed-off-by: Pagwin <dev@pagwin.xyz>
This commit is contained in:
Pagwin
2025-11-21 16:19:41 -05:00
parent 1dae1a210b
commit fca8ac40ff
2 changed files with 7 additions and 6 deletions

View File

@@ -146,7 +146,7 @@ void ModFolderPage::downloadMods()
auto profile = static_cast<MinecraftInstance*>(m_instance)->getPackProfile(); auto profile = static_cast<MinecraftInstance*>(m_instance)->getPackProfile();
if (!profile->getModLoaders().has_value()) { if (!profile->getModLoaders().has_value()) {
if (HandleNoModLoader()) { if (handleNoModLoader()) {
return; return;
} }
} }
@@ -203,7 +203,7 @@ void ModFolderPage::updateMods(bool includeDeps)
auto profile = static_cast<MinecraftInstance*>(m_instance)->getPackProfile(); auto profile = static_cast<MinecraftInstance*>(m_instance)->getPackProfile();
if (!profile->getModLoaders().has_value()) { if (!profile->getModLoaders().has_value()) {
if (HandleNoModLoader()) { if (handleNoModLoader()) {
return; return;
} }
} }
@@ -308,7 +308,7 @@ void ModFolderPage::changeModVersion()
auto profile = static_cast<MinecraftInstance*>(m_instance)->getPackProfile(); auto profile = static_cast<MinecraftInstance*>(m_instance)->getPackProfile();
if (!profile->getModLoaders().has_value()) { if (!profile->getModLoaders().has_value()) {
if (HandleNoModLoader()) { if (handleNoModLoader()) {
return; return;
} }
} }
@@ -391,7 +391,7 @@ bool NilModFolderPage::shouldDisplay() const
} }
// Helper function so this doesn't need to be duplicated 3 times // Helper function so this doesn't need to be duplicated 3 times
inline bool ModFolderPage::HandleNoModLoader() inline bool ModFolderPage::handleNoModLoader()
{ {
int resp = QMessageBox::question(this, this->tr("Missing ModLoader"), int resp = QMessageBox::question(this, this->tr("Missing ModLoader"),
this->tr("You need to install a mod loader before installing mods, would you like to do so?"), this->tr("You need to install a mod loader before installing mods, would you like to do so?"),
@@ -413,7 +413,8 @@ inline bool ModFolderPage::HandleNoModLoader()
} }
default: { default: {
// Unreachable // Unreachable
break; // returning true as a safety measure
return true;
} }
} }
} }

View File

@@ -45,7 +45,7 @@
class ModFolderPage : public ExternalResourcesPage { class ModFolderPage : public ExternalResourcesPage {
Q_OBJECT Q_OBJECT
bool HandleNoModLoader(); inline bool handleNoModLoader();
public: public:
explicit ModFolderPage(BaseInstance* inst, std::shared_ptr<ModFolderModel> model, QWidget* parent = nullptr); explicit ModFolderPage(BaseInstance* inst, std::shared_ptr<ModFolderModel> model, QWidget* parent = nullptr);