Skip to content

Commit

Permalink
fix(dropdownfield): upgraded fields from 2.5 may crash
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
  • Loading branch information
btry committed Apr 19, 2019
1 parent 1cec1e0 commit 8233b75
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion inc/fields/dropdownfield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,11 @@ public static function getName() {
public function isValid() {
// If the field is required it can't be empty
$itemtype = json_decode($this->fields['values'], true);
$itemtype = $itemtype['itemtype'];
if ($itemtype === null) {
$itemtype = $this->fields['values'];
} else {
$itemtype = $itemtype['itemtype'];
}
$dropdown = new $itemtype();
if ($this->isRequired() && $dropdown->isNewId($this->value)) {
Session::addMessageAfterRedirect(
Expand Down

0 comments on commit 8233b75

Please sign in to comment.