Skip to content

Commit f73995e

Browse files
authored
Update navbar-hover.cpp
1 parent 8030683 commit f73995e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/navbar-hover.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ std::optional<Config> read_config() {
185185
}
186186

187187
std::ifstream file(cache_home + "/nekoroshell/navbar-hover.conf");
188+
if (!file.is_open()) return std::nullopt;
188189

189190
if (file.is_open()) {
190191
std::string line;
@@ -211,7 +212,11 @@ int main() {
211212

212213
std::thread(swaync_watcher_thread).detach();
213214

214-
Config cfg = read_config();
215+
auto result = read_config();
216+
if (!result) {
217+
return 1;
218+
}
219+
Config cfg = *result;
215220
std::vector<Monitor> monitors = backend->get_monitors();
216221
int cycle_count = 0;
217222

@@ -259,7 +264,7 @@ int main() {
259264
}
260265

261266
if (++cycle_count >= 100) {
262-
cfg = read_config();
267+
cfg = *result;
263268
monitors = backend->get_monitors();
264269
cycle_count = 0;
265270
}

0 commit comments

Comments
 (0)