added empty path validation #45
Merged@github-juk3n wants to merge
44-warning-when-no-game-found-after-play into mainMerged as
21b17375d3a2.1 file changed
modified
app/src/fluffyApplication.cpp +6 -1 | @@ -4,7 +4,12 @@ | ||
| 4 | 4 | |
| 5 | 5 | auto FluffyApplication::runGame(std::string gameName) -> void { |
| 6 | 6 | std::string pathToRun = gameRepository->getGameByName(gameName).getPath(); |
| 7 | - system(pathToRun.c_str()); | |
| 7 | + if(pathToRun.empty()) { | |
| 8 | + std::cout << "no application found" << std::endl; | |
| 9 | + } | |
| 10 | + else { | |
| 11 | + system(pathToRun.c_str()); | |
| 12 | + } | |
| 8 | 13 | } |
| 9 | 14 | |
| 10 | 15 | auto FluffyApplication::handleCommand( |
| @@ -4,7 +4,12 @@ | |||
| 4 | 4 | ||
| 5 | auto FluffyApplication::runGame(std::string gameName) -> void { | 5 | auto FluffyApplication::runGame(std::string gameName) -> void { |
| 6 | std::string pathToRun = gameRepository->getGameByName(gameName).getPath(); | 6 | std::string pathToRun = gameRepository->getGameByName(gameName).getPath(); |
| 7 | - system(pathToRun.c_str()); | 7 | + if(pathToRun.empty()) { |
| 8 | + std::cout << "no application found" << std::endl; | ||
| 9 | + } | ||
| 10 | + else { | ||
| 11 | + system(pathToRun.c_str()); | ||
| 12 | + } | ||
| 8 | } | 13 | } |
| 9 | 14 | ||
| 10 | auto FluffyApplication::handleCommand( | 15 | auto FluffyApplication::handleCommand( |