X-Git-Url: https://git.mxchange.org/?p=core.git;a=blobdiff_plain;f=framework%2Fmain%2Fexceptions%2Fmain%2Fclass_NullPointerException.php;h=ecb7bac4647c308deaac8568ea1b235b64bd7826;hp=f8fb0eeeb728d4ebfc4872b8989706a5a0a1ec83;hb=5da8f717122568335b8a8ab230fa0de17e983fab;hpb=887340f2efadd02aa4a1e6d6d86529570184efa5
diff --git a/framework/main/exceptions/main/class_NullPointerException.php b/framework/main/exceptions/main/class_NullPointerException.php
index f8fb0eee..ecb7bac4 100644
--- a/framework/main/exceptions/main/class_NullPointerException.php
+++ b/framework/main/exceptions/main/class_NullPointerException.php
@@ -36,12 +36,20 @@ class NullPointerException extends FrameworkException {
* @param $code Code number for the exception
* @return void
*/
- public function __construct (FrameworkInterface $class, $code) {
- // Add a message around the missing class
- $message = sprintf('[%s:%d] An object instance is set to null.',
- $class->__toString(),
- $this->getLine()
- );
+ public function __construct (FrameworkInterface $class = NULL, $code) {
+ // Is the instance set?
+ if (is_null($class)) {
+ // Add a message around the missing class
+ $message = sprintf('[unknown:%d] An object instance is set to null.',
+ $this->getLine()
+ );
+ } else {
+ // Add a message around the missing class
+ $message = sprintf('[%s:%d] An object instance is set to null.',
+ $class->__toString(),
+ $this->getLine()
+ );
+ }
// Call parent constructor
parent::__construct($message, $code);