From: Christoph Wolk Date: Tue, 25 Mar 2025 09:46:10 +0000 (+0100) Subject: [PATCH] applets/systemmonitor: handle null faceController X-Git-Tag: archive/raspbian/4%6.3.6-2+rpi1^2~15 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b701760dfff393d5d79a742f09a2abf4c998bf1d;p=plasma-workspace.git [PATCH] applets/systemmonitor: handle null faceController When initially adding a systemmonitor widget to a panel, faceController can still be null, causing several TypeErrors. Instead, use optional chaining and default values to prevent these errors until the faceController is loaded. Gbp-Pq: Name upstream_d4df9b5f_applets-systemmonitor-handle-null-faceController.patch --- diff --git a/applets/systemmonitor/systemmonitor/package/contents/ui/main.qml b/applets/systemmonitor/systemmonitor/package/contents/ui/main.qml index f41f11d3..6d4480ca 100644 --- a/applets/systemmonitor/systemmonitor/package/contents/ui/main.qml +++ b/applets/systemmonitor/systemmonitor/package/contents/ui/main.qml @@ -59,7 +59,7 @@ PlasmoidItem { preferredRepresentation: Plasmoid.formFactor === PlasmaCore.Types.Planar ? fullRepresentation : null - Plasmoid.title: Plasmoid.faceController.title || i18n("System Monitor") + Plasmoid.title: Plasmoid.faceController?.title || i18n("System Monitor") toolTipSubText: totalSensor.sensorId ? i18nc("Sensor name: value", "%1: %2", totalSensor.name, totalSensor.formattedValue) : "" compactRepresentation: CompactRepresentation { @@ -67,12 +67,12 @@ PlasmoidItem { fullRepresentation: FullRepresentation { } - Plasmoid.configurationRequired: Plasmoid.faceController.highPrioritySensorIds.length == 0 && Plasmoid.faceController.lowPrioritySensorIds.length == 0 && Plasmoid.faceController.totalSensors.length == 0 + Plasmoid.configurationRequired: (Plasmoid.faceController ?? false) && Plasmoid.faceController.highPrioritySensorIds.length == 0 && Plasmoid.faceController.lowPrioritySensorIds.length == 0 && Plasmoid.faceController.totalSensors.length == 0 Sensors.Sensor { id: totalSensor - sensorId: Plasmoid.faceController.totalSensors[0] || "" - updateRateLimit: Plasmoid.faceController.updateRateLimit + sensorId: Plasmoid.faceController?.totalSensors[0] || "" + updateRateLimit: Plasmoid.faceController?.updateRateLimit } MouseArea {