diff --git a/src/util/ScreenshotUtil.cpp b/src/util/ScreenshotUtil.cpp index 41f07544..ebd0889f 100644 --- a/src/util/ScreenshotUtil.cpp +++ b/src/util/ScreenshotUtil.cpp @@ -45,7 +45,7 @@ bool ScreenshotUtil::saveFramebufferAsBmp(const char* filename, const uint8_t* f std::string path(filename); size_t last_slash = path.find_last_of('/'); - if (last_slash != std::string::npos) { + if (last_slash != std::string::npos && last_slash > 0) { std::string dir = path.substr(0, last_slash); if (!Storage.exists(dir.c_str())) { if (!Storage.mkdir(dir.c_str())) {