GetUniformLocation() had a bad check.

The way the if statements were structured allowed an erroneous condition
to happen. If the uniform wasn't found and the program was invalid then
it would try to lookup the uniform anyway because it was an else
statement.

This has been fixed by checking if the shader is valid first