diff --git a/gfx/drivers_context/wayland_ctx.c b/gfx/drivers_context/wayland_ctx.c index 67071e33d1..f9951e5811 100644 --- a/gfx/drivers_context/wayland_ctx.c +++ b/gfx/drivers_context/wayland_ctx.c @@ -399,11 +399,13 @@ static bool gfx_ctx_wl_set_resize(void *data, unsigned width, unsigned height) static void gfx_ctx_wl_update_window_title(void *data) { - char buf[128] = {0}; - char buf_fps[128] = {0}; + char buf[128]; + char buf_fps[128]; settings_t *settings = config_get_ptr(); gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; + buf[0] = buf_fps[0] = '\0'; + if (video_monitor_get_fps(buf, sizeof(buf), buf_fps, sizeof(buf_fps))) wl_shell_surface_set_title(wl->shell_surf, buf); @@ -417,7 +419,8 @@ static bool gfx_ctx_wl_get_metrics(void *data, enum display_metric_types type, float *value) { gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; - if (wl->physical_width == 0 || wl->physical_height == 0) + + if (!wl || wl->physical_width == 0 || wl->physical_height == 0) return false; switch (type)