diff --git a/src/utils.cpp b/src/utils.cpp index 14def44..c901c21 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -55,6 +55,7 @@ ssize_t readFile2(std::string path, char* buffer, size_t maxlen) { std::string readFile(std::string path, size_t trim) { char buf[trim + 2]; ssize_t len = readFile2(path, buf, trim + 2); + if (!len) return "0"; std::string out(buf); return out.substr(0, len - 1); }