diff --git a/applets/digital-clock/package/contents/ui/Tooltip.qml b/applets/digital-clock/package/contents/ui/Tooltip.qml index 84367967f..889e03816 100644 --- a/applets/digital-clock/package/contents/ui/Tooltip.qml +++ b/applets/digital-clock/package/contents/ui/Tooltip.qml @@ -36,6 +36,11 @@ Item { LayoutMirroring.childrenInherit: true function timeForZone(zone) { + var compactRepresentationItem = plasmoid.compactRepresentationItem; + if (!compactRepresentationItem) { + return ""; + } + // get the time for the given timezone from the dataengine var now = dataSource.data[zone]["DateTime"]; // get current UTC time @@ -43,10 +48,10 @@ Item { // add the dataengine TZ offset to it var dateTime = new Date(msUTC + (dataSource.data[zone]["Offset"] * 1000)); - var formattedTime = Qt.formatTime(dateTime, plasmoid.compactRepresentationItem.timeFormat); + var formattedTime = Qt.formatTime(dateTime, compactRepresentationItem.timeFormat); if (dateTime.getDay() != dataSource.data["Local"]["DateTime"].getDay()) { - formattedTime += " (" + Qt.formatDate(dateTime, plasmoid.compactRepresentationItem.dateFormat) + ")"; + formattedTime += " (" + Qt.formatDate(dateTime, compactRepresentationItem.dateFormat) + ")"; } return formattedTime;