From a993474954c6b31d8980f93e25110c1f8e3d9c24 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Luca=20B=C3=B6sch?= <luca.boesch@bfh.ch>
Date: Mon, 27 May 2019 15:11:37 +0200
Subject: [PATCH] Check existance of properties before accessing them.

---
 CHANGES.md |  1 +
 lib.php    | 12 ++++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 40baa99..470082d 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -6,6 +6,7 @@ Changes
 
 ### Unreleased
 
+* 2019-05-29 - Check existence of property blockcolumnwidth before accessing it.
 * 2019-05-29 - Login background image did not fill the page completely when browser window was really low but really wide.
 * 2019-05-27 - Added multilanguage filtering to the login background image texts.
 * 2019-05-24 - Prevent back-to-top button from being printed.
diff --git a/lib.php b/lib.php
index 05ce1fe..22c3031 100644
--- a/lib.php
+++ b/lib.php
@@ -120,15 +120,19 @@ function theme_boost_campus_get_pre_scss($theme) {
 
     // MODIFICATION START: Overwrite Boost core SCSS variables which need units and thus couldn't be added to $configurable above.
     // Set variables which are processed in the context of the blockcolumnwidth setting.
-    $scss .= '$blocks-column-width: ' . $theme->settings->blockcolumnwidth . "px;\n";
-    $scss .= '$grid-gutter-width: '. "30px;\n";
+    if (isset($theme->settings->blockcolumnwidth)) {
+        $scss .= '$blocks-column-width: ' . $theme->settings->blockcolumnwidth . "px;\n";
+        $scss .= '$grid-gutter-width: ' . "30px;\n";
+    }
     // MODIFICATION END.
 
     // MODIFICATION START: Set own SCSS variables which need units or calculations and thus couldn't be
     // added to $configurable above.
     // Set variables which are processed in the context of the blockcolumnwidth setting.
-    $scss .= '$blocks-column-width-dashboard: ' . $theme->settings->blockcolumnwidthdashboard . "px;\n";
-    $scss .= '$blocks-plus-gutter-dashboard: $blocks-column-width-dashboard + ( $grid-gutter-width / 2 )' . ";\n";
+    if (isset($theme->settings->blockcolumnwidthdashboard)) {
+        $scss .= '$blocks-column-width-dashboard: ' . $theme->settings->blockcolumnwidthdashboard . "px;\n";
+        $scss .= '$blocks-plus-gutter-dashboard: $blocks-column-width-dashboard + ( $grid-gutter-width / 2 )' . ";\n";
+    }
     // MODIFICATION END.
 
     // MODIFICATION START: Add login background images that are uploaded to the setting 'loginbackgroundimage' to CSS.
-- 
GitLab