1. rude
  2. love

Commits

Alex Szpakowski  committed e62c700

Fixed love.graphics.newShader crashing when extern variables with very short names are used

  • Participants
  • Parent commits 19c2a11
  • Branches default

Comments (0)

Files changed (1)

File src/modules/graphics/opengl/Shader.cpp

View file
 		delete[] cname;
 
 		// glGetActiveUniform appends "[0]" to the end of array uniform names...
-		if (u.name.find("[0]") == u.name.length() - 3)
-			u.name.erase(u.name.length() - 3);
+		if (u.name.length() > 3)
+		{
+			size_t findpos = u.name.find("[0]");
+			if (findpos != std::string::npos && findpos == u.name.length() - 3)
+				u.name.erase(u.name.length() - 3);
+		}
 
 		if (u.location != -1)
 			uniforms[u.name] = u;