Continued with unit tests:
[core.git] / framework / main / exceptions / main / class_NullPointerException.php
index f8fb0eeeb728d4ebfc4872b8989706a5a0a1ec83..ecb7bac4647c308deaac8568ea1b235b64bd7826 100644 (file)
@@ -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 <em>null</em>.',
-                       $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 <em>null</em>.',
+                               $this->getLine()
+                       );
+               } else {
+                       // Add a message around the missing class
+                       $message = sprintf('[%s:%d] An object instance is set to <em>null</em>.',
+                               $class->__toString(),
+                               $this->getLine()
+                       );
+               }
 
                // Call parent constructor
                parent::__construct($message, $code);