Add missing CheckGLError and whitespace tidy up this block. Fixes #1878
Merge pull request #2373 from danzel/fix-1878

Add missing CheckGLError