Index: trunk/src/lib/graphics/shader.cc
===================================================================
--- trunk/src/lib/graphics/shader.cc	(revision 10142)
+++ trunk/src/lib/graphics/shader.cc	(revision 10143)
@@ -52,4 +52,5 @@
   }
 }
+
 void Shader::Uniform::setV(unsigned int count, int* vv) const
 {
@@ -96,5 +97,4 @@
     PRINTF(2)("Your system does not support shaders\n");
   this->load(vertexShaderFile, fragmentShaderFile);
-
 }
 
Index: trunk/src/lib/graphics/shader.h
===================================================================
--- trunk/src/lib/graphics/shader.h	(revision 10142)
+++ trunk/src/lib/graphics/shader.h	(revision 10143)
@@ -22,16 +22,16 @@
   {
   public:
-	  Uniform(const Shader& shader, const std::string& location) { if (Shader::isSupported()) this->uniform = glGetUniformLocation(shader.getProgram(), location.c_str()) ; };
-	  Uniform(GLhandleARB shaderProgram, const std::string& location) { if (Shader::isSupported()) this->uniform = glGetUniformLocation(shaderProgram, location.c_str()) ; };
+    Uniform(const Shader& shader, const std::string& location) { if (Shader::isSupported()) this->uniform = glGetUniformLocation(shader.getProgram(), location.c_str()) ; };
+  Uniform(GLhandleARB shaderProgram, const std::string& location) { if (Shader::isSupported()) this->uniform = glGetUniformLocation(shaderProgram, location.c_str()) ; };
 
-    void set(float v0) const { if (Shader::isSupported()) glUniform1f(this->uniform, v0); }
-    void set(float v0, float v1) const { if (Shader::isSupported()) glUniform2f(this->uniform, v0, v1); }
-    void set(float v0, float v1, float v2) const { if (Shader::isSupported()) glUniform3f(this->uniform, v0, v1, v2); }
-    void set(float v0, float v1, float v2, float v3) const { if (Shader::isSupported()) glUniform4f(this->uniform, v0, v1, v2, v3); }
+  void set(float v0) const { if (Shader::isSupported()) glUniform1f(this->uniform, v0); }
+  void set(float v0, float v1) const { if (Shader::isSupported()) glUniform2f(this->uniform, v0, v1); }
+  void set(float v0, float v1, float v2) const { if (Shader::isSupported()) glUniform3f(this->uniform, v0, v1, v2); }
+  void set(float v0, float v1, float v2, float v3) const { if (Shader::isSupported()) glUniform4f(this->uniform, v0, v1, v2, v3); }
 
-    void set(int v0) const { if (Shader::isSupported()) glUniform1i(this->uniform, v0); }
-    void set(int v0, int v1) const { if (Shader::isSupported()) glUniform2i(this->uniform, v0, v1); }
-    void set(int v0, int v1, int v2) const { if (Shader::isSupported()) glUniform3i(this->uniform, v0, v1, v2); }
-    void set(int v0, int v1, int v2, int v3) const {if (Shader::isSupported())  glUniform4i(this->uniform, v0, v1, v2, v3); }
+  void set(int v0) const { if (Shader::isSupported()) glUniform1i(this->uniform, v0); }
+  void set(int v0, int v1) const { if (Shader::isSupported()) glUniform2i(this->uniform, v0, v1); }
+  void set(int v0, int v1, int v2) const { if (Shader::isSupported()) glUniform3i(this->uniform, v0, v1, v2); }
+  void set(int v0, int v1, int v2, int v3) const {if (Shader::isSupported())  glUniform4i(this->uniform, v0, v1, v2, v3); }
 
     void setV(unsigned int count, float* vv) const;
@@ -53,5 +53,5 @@
 
   bool load(const std::string& vertexShaderFile, const std::string& fragmentShaderFile = "")
-    { return this->data->load(vertexShaderFile, fragmentShaderFile); }
+  { return this->data->load(vertexShaderFile, fragmentShaderFile); }
 
 
@@ -71,5 +71,5 @@
   static bool isSupported() { return checkShaderAbility(); };
 
-  inline static bool isShaderActive() { return (Shader::storedShader != NULL) ? true : false; };
+inline static bool isShaderActive() { return (Shader::storedShader != NULL) ? true : false; };
   inline static const Shader* getActiveShader() { return Shader::storedShader; };
 
@@ -78,5 +78,5 @@
 
 private:
-  ShaderData::Pointer    data;
+  ShaderData::Pointer          data;
 
   static const Shader*         storedShader;
Index: trunk/src/lib/graphics/shader_data.cc
===================================================================
--- trunk/src/lib/graphics/shader_data.cc	(revision 10142)
+++ trunk/src/lib/graphics/shader_data.cc	(revision 10143)
@@ -65,5 +65,5 @@
     return true;
   }
-  
+
   return true;
 }
@@ -74,4 +74,8 @@
 ShaderData::~ShaderData ()
 {
+  if (shaderProgram == 0)
+    return;
+
+
   if (this->shaderProgram == glGetHandleARB(GL_PROGRAM_OBJECT_ARB))
     glUseProgramObjectARB(0);
