From be66d710b3b54f9b3a89a234359e4faa5b9352a8 Mon Sep 17 00:00:00 2001 From: Filip Markovic Date: Sun, 18 Dec 2022 22:27:13 +0100 Subject: [PATCH] Adjust to match modern c++ style --- src/Hyprpaper.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Hyprpaper.cpp b/src/Hyprpaper.cpp index 70ebde8..c569038 100644 --- a/src/Hyprpaper.cpp +++ b/src/Hyprpaper.cpp @@ -136,10 +136,12 @@ void CHyprpaper::recheckMonitor(SMonitor* pMonitor) { zwlr_layer_surface_v1_ack_configure(pMonitor->pCurrentLayerSurface->pLayerSurface, pMonitor->configureSerial); int XCURSOR_SIZE = 24; - if (getenv("XCURSOR_SIZE") != NULL) { - char *endptr; - XCURSOR_SIZE = strtol(getenv("XCURSOR_SIZE"), &endptr, 10); - if (*endptr || XCURSOR_SIZE <= 0) { + if (const auto CURSORSIZENV = getenv("XCURSOR_SIZE"); CURSORSIZENV) { + try { + if (XCURSOR_SIZE = std::stoi(CURSORSIZENV); XCURSOR_SIZE <= 0) { + throw std::exception(); + } + } catch (...) { Debug::log(WARN, "XCURSOR_SIZE environment variable is set incorrectly"); XCURSOR_SIZE = 24; }