summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/private/AppFramework/Utility/SimpleContainer.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/private/AppFramework/Utility/SimpleContainer.php b/lib/private/AppFramework/Utility/SimpleContainer.php
index 5f637518f4d..60496ca329e 100644
--- a/lib/private/AppFramework/Utility/SimpleContainer.php
+++ b/lib/private/AppFramework/Utility/SimpleContainer.php
@@ -62,7 +62,16 @@ class SimpleContainer extends Container implements IContainer {
$resolveName = $parameterClass->name;
}
- $parameters[] = $this->query($resolveName);
+ try {
+ $parameters[] = $this->query($resolveName);
+ } catch (\Exception $e) {
+ // Service not found, use the default value when available
+ if ($parameter->isDefaultValueAvailable()) {
+ $parameters[] = $parameter->getDefaultValue();
+ } else {
+ throw $e;
+ }
+ }
}
return $class->newInstanceArgs($parameters);
}