Fix error when shader can't link

Calling glValidateProgram clears glGetProgramInfoLog, so must check for
link error before validating.