Ensure the resource manager exists when displaying an error message
Ensure the resource manager exists when displaying an error message

--- a/include/resource/Resource.class.php
+++ b/include/resource/Resource.class.php
@@ -43,8 +43,6 @@
 	 */
 	public static function GetInstance()
 	{
-		if (!self::$instance)
-			throw new Exception('Resource provider not instantiated');
 		return self::$instance;
 	}
 

file:a/index.php -> file:b/index.php
--- a/index.php
+++ b/index.php
@@ -89,6 +89,14 @@
 		throw $e;
 	}
 
+	if (GitPHP_Resource::GetInstance() == null) {
+		/*
+		 * In case an error was thrown before instantiating
+		 * the resource manager
+		 */
+		GitPHP_Resource::Instantiate('en_US');
+	}
+
 	require_once(GITPHP_CONTROLLERDIR . 'Controller_Message.class.php');
 	$controller = new GitPHP_Controller_Message();
 	$controller->SetParam('message', $e->getMessage());

comments