diff --git a/src/renderer/widgets/IWidget.cpp b/src/renderer/widgets/IWidget.cpp index 5aa21e1..053d021 100644 --- a/src/renderer/widgets/IWidget.cpp +++ b/src/renderer/widgets/IWidget.cpp @@ -48,8 +48,13 @@ static std::string getTime() { IWidget::SFormatResult IWidget::formatString(std::string in) { + char* username = getlogin(); + + if (!username) + Debug::log(ERR, "Error in formatString, username null. Errno: ", errno); + IWidget::SFormatResult result; - replaceAll(in, "$USER", std::string{getlogin()}); + replaceAll(in, "$USER", std::string{username ? username : ""}); replaceAll(in, "
", std::string{"\n"}); if (in.contains("$TIME")) {