Commit fe5edf72 authored by Tobias Zimmermann's avatar Tobias Zimmermann Committed by Mateu Aguiló Bosch
Browse files

Issue #3267346 by tstoeckler, e0ipso: Invalid consumer ID leads to exceptions

parent 6fcd8331
Loading
Loading
Loading
Loading
+10 −9
Original line number Diff line number Diff line
@@ -71,16 +71,17 @@ class Negotiator {
        $consumer_uuid = $request->query->get('_consumer_id');
      }
    }
    if (!$consumer_uuid) {
      return $this->loadDefaultConsumer();
    }
    if ($consumer_uuid) {
      try {
        /** @var \Drupal\consumers\Entity\Consumer $consumer */
        $consumer = $this->entityRepository->loadEntityByUuid('consumer', $consumer_uuid);
      }
      catch (EntityStorageException $exception) {
        watchdog_exception('consumers', $exception);
      return $this->loadDefaultConsumer();
      }
    }
    if (empty($consumer)) {
      $consumer = $this->loadDefaultConsumer();
    }
    return $consumer;
  }