check for not existing controller function

This commit is contained in:
Daniel Seifert 2022-10-06 14:20:01 +02:00
parent 75146c8a08
commit 4c21a850d8
Signed by: DanielS
GPG Key ID: 8A7C4C6ED1915C6F
2 changed files with 6 additions and 2 deletions

View File

@ -49,7 +49,9 @@ class ShopControl_DebugBar extends ShopControl_DebugBar_parent
if (AvailabilityCheck::isAvailable() && AvailabilityCheck::ifDebugBarNotSet() && AvailabilityCheck::ifNoErrorOccured()) {
$activeView = Registry::getConfig()->getTopActiveView();
/** @var DebugBarComponent|null $debugBarComponent */
$debugBarComponent = $activeView->getComponent(DebugBarComponent::class);
$debugBarComponent = method_exists($activeView, 'getComponent')
? $activeView->getComponent(DebugBarComponent::class)
: null;
if ($debugBarComponent) {
AvailabilityCheck::markDebugBarAsSet();
echo $debugBarComponent->getRenderer()->renderHead();

View File

@ -97,7 +97,9 @@ function debugVar($mVar, bool $blToFile = false): void
}
$activeView = Registry::getConfig()->getTopActiveView();
/** @var DebugBarComponent|null $debugBarComponent */
$debugBarComponent = $activeView->getComponent(DebugBarComponent::class);
$debugBarComponent = method_exists($activeView, 'getComponent')
? $activeView->getComponent(DebugBarComponent::class)
: null;
if ($debugBarComponent === null) {
throw new UnavailableException();
}