From: Tim Düsterhus Date: Tue, 18 Apr 2023 09:12:14 +0000 (+0200) Subject: Fix StyleEditor::update() for absent variables X-Git-Tag: 6.0.0_Alpha_1~236 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a1768086a8c4800b7cac2c4945969a2183326143;p=GitHub%2FWoltLab%2FWCF.git Fix StyleEditor::update() for absent variables see d7fad3385012cd86b33b9262c47040b1c7267826 --- diff --git a/wcfsetup/install/files/lib/data/style/StyleEditor.class.php b/wcfsetup/install/files/lib/data/style/StyleEditor.class.php index ab390a478c..10b2d0c5de 100644 --- a/wcfsetup/install/files/lib/data/style/StyleEditor.class.php +++ b/wcfsetup/install/files/lib/data/style/StyleEditor.class.php @@ -71,17 +71,19 @@ final class StyleEditor extends DatabaseObjectEditor implements IEditableCachedO parent::update($parameters); - $variables = $variablesDarkMode = []; - $prefixLength = \strlen(Style::DARK_MODE_PREFIX); - foreach ($inputVariables as $variableName => $variableValue) { - if (\str_starts_with($variableName, Style::DARK_MODE_PREFIX)) { - $variablesDarkMode[\substr($variableName, $prefixLength)] = $variableValue; - } else { - $variables[$variableName] = $variableValue; + if ($inputVariables !== null) { + $variables = $variablesDarkMode = []; + $prefixLength = \strlen(Style::DARK_MODE_PREFIX); + foreach ($inputVariables as $variableName => $variableValue) { + if (\str_starts_with($variableName, Style::DARK_MODE_PREFIX)) { + $variablesDarkMode[\substr($variableName, $prefixLength)] = $variableValue; + } else { + $variables[$variableName] = $variableValue; + } } - } - $this->setVariables($variables, $variablesDarkMode); + $this->setVariables($variables, $variablesDarkMode); + } } /**