Skip to content

Commit cf3cbed

Browse files
committed
minor: cleaning up const and renaming variables
1 parent 2289ec0 commit cf3cbed

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

src/background_client.cpp

+5-14
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ struct BackgroundClient::Self : egmde::FullscreenClient
106106

107107
void render_text(uint32_t width, uint32_t height, unsigned char* buffer) const;
108108

109-
bool wallpaper_enabled;
109+
bool const wallpaper_enabled;
110110
Colour const& wallpaper_top_colour;
111111
Colour const& wallpaper_bottom_colour;
112112
Colour const& crash_background_colour;
@@ -388,18 +388,9 @@ void BackgroundClient::Self::draw_screen(SurfaceInfo& info, bool draws_crash) co
388388
std::lock_guard lock{buffer_mutex};
389389

390390
// Don't draw diagnostic background if file is empty or font not found
391-
bool file_exists;
392-
if (fs::exists(diagnostic_path.value_or("")))
393-
{
394-
file_exists = fs::file_size(diagnostic_path.value());
395-
}
396-
else
397-
{
398-
file_exists = false;
399-
}
400-
401-
bool should_draw_crash = draws_crash && file_exists;
402-
if (!wallpaper_enabled && !should_draw_crash)
391+
bool const have_diagnostic = diagnostic_path && fs::exists(diagnostic_path.value()) && fs::file_size(diagnostic_path.value());
392+
bool const should_show_diagnostic = draws_crash && have_diagnostic;
393+
if (!wallpaper_enabled && !should_show_diagnostic)
403394
{
404395
return;
405396
}
@@ -445,7 +436,7 @@ void BackgroundClient::Self::draw_screen(SurfaceInfo& info, bool draws_crash) co
445436

446437
auto buffer = static_cast<unsigned char*>(info.content_area);
447438

448-
if (should_draw_crash)
439+
if (should_show_diagnostic)
449440
{
450441
render_background(width, height, buffer, crash_background_colour);
451442
render_text(width, height, buffer);

0 commit comments

Comments
 (0)