From a8e046ce073efd1bc8cbd016f4ac3c3c0176ce4e Mon Sep 17 00:00:00 2001 From: Benedikt Galbavy Date: Mon, 24 Jun 2024 18:27:04 +0200 Subject: [PATCH] #58 added exception for missing game implementation --- include/GameFactory.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/GameFactory.h b/include/GameFactory.h index 1da56a7..c10a0b0 100644 --- a/include/GameFactory.h +++ b/include/GameFactory.h @@ -5,6 +5,7 @@ #include #include #include +#include #include "Game.h" @@ -36,8 +37,10 @@ public: } Game* create(GameInternal* gameInternal) { - if (this->creatorFunc == nullptr) + if (this->creatorFunc == nullptr) { + throw std::runtime_error("No game implementation registered!"); return nullptr; + } Game* game = (this->creatorFunc)(); game->gameInternal = gameInternal; return game;