mirror of
https://github.com/hyprwm/hyprlock.git
synced 2025-12-20 00:40:03 +01:00
pam: prevent nullpointer crash when user passwd isn't found (#928)
This commit is contained in:
parent
e2da7c6b1f
commit
d099f87d36
1 changed files with 2 additions and 2 deletions
|
|
@ -186,8 +186,8 @@ static std::string getTime12h() {
|
||||||
IWidget::SFormatResult IWidget::formatString(std::string in) {
|
IWidget::SFormatResult IWidget::formatString(std::string in) {
|
||||||
|
|
||||||
auto uidPassword = getpwuid(getuid());
|
auto uidPassword = getpwuid(getuid());
|
||||||
char* username = uidPassword->pw_name;
|
char* username = uidPassword ? uidPassword->pw_name : nullptr;
|
||||||
char* user_gecos = uidPassword->pw_gecos;
|
char* user_gecos = uidPassword ? uidPassword->pw_gecos : nullptr;
|
||||||
|
|
||||||
if (!username)
|
if (!username)
|
||||||
Debug::log(ERR, "Error in formatString, username null. Errno: ", errno);
|
Debug::log(ERR, "Error in formatString, username null. Errno: ", errno);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue