Skip to content

Commit

Permalink
fingerprint: handle failed dbus connection (#676)
Browse files Browse the repository at this point in the history
  • Loading branch information
PaideiaDilemma authored Feb 5, 2025
1 parent ec82da7 commit ce75045
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/auth/Fingerprint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,15 @@ CFingerprint::~CFingerprint() {
}

void CFingerprint::init() {
m_sDBUSState.connection = sdbus::createSystemBusConnection();
m_sDBUSState.login = sdbus::createProxy(*m_sDBUSState.connection, sdbus::ServiceName{"org.freedesktop.login1"}, sdbus::ObjectPath{"/org/freedesktop/login1"});
try {
m_sDBUSState.connection = sdbus::createSystemBusConnection();
m_sDBUSState.login = sdbus::createProxy(*m_sDBUSState.connection, sdbus::ServiceName{"org.freedesktop.login1"}, sdbus::ObjectPath{"/org/freedesktop/login1"});
} catch (sdbus::Error& e) {
Debug::log(ERR, "fprint: Failed to setup dbus ({})", e.what());
m_sDBUSState.connection.reset();
return;
}

m_sDBUSState.login->getPropertyAsync("PreparingForSleep").onInterface(LOGIN_MANAGER).uponReplyInvoke([this](std::optional<sdbus::Error> e, sdbus::Variant preparingForSleep) {
if (e) {
Debug::log(WARN, "fprint: Failed getting value for PreparingForSleep: {}", e->what());
Expand Down

0 comments on commit ce75045

Please sign in to comment.