added empty path validation (#45)Unverified
Co-authored-by: Adrian Duraj <adrian.duraj@onmail.com>
21b1737 parent: 3f47fb3 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( |