diff --git a/internal/graphicsdriver/opengl/gl/default_cgo.go b/internal/graphicsdriver/opengl/gl/default_cgo.go index 234f9a707..244b33ee0 100644 --- a/internal/graphicsdriver/opengl/gl/default_cgo.go +++ b/internal/graphicsdriver/opengl/gl/default_cgo.go @@ -592,6 +592,9 @@ func (c *defaultContext) GetInteger(pname uint32) int { func (c *defaultContext) GetProgramInfoLog(program uint32) string { bufSize := c.GetProgrami(program, INFO_LOG_LENGTH) + if bufSize == 0 { + return "" + } infoLog := make([]byte, bufSize) C.glowGetProgramInfoLog(c.gpGetProgramInfoLog, C.GLuint(program), C.GLsizei(bufSize), nil, (*C.GLchar)(unsafe.Pointer(&infoLog[0]))) return string(infoLog) @@ -605,6 +608,9 @@ func (c *defaultContext) GetProgrami(program uint32, pname uint32) int { func (c *defaultContext) GetShaderInfoLog(shader uint32) string { bufSize := c.GetShaderi(shader, INFO_LOG_LENGTH) + if bufSize == 0 { + return "" + } infoLog := make([]byte, bufSize) C.glowGetShaderInfoLog(c.gpGetShaderInfoLog, C.GLuint(shader), C.GLsizei(bufSize), nil, (*C.GLchar)(unsafe.Pointer(&infoLog[0]))) return string(infoLog) diff --git a/internal/graphicsdriver/opengl/gl/default_purego.go b/internal/graphicsdriver/opengl/gl/default_purego.go index 1e18d5730..05e65b570 100644 --- a/internal/graphicsdriver/opengl/gl/default_purego.go +++ b/internal/graphicsdriver/opengl/gl/default_purego.go @@ -300,6 +300,9 @@ func (c *defaultContext) GetInteger(pname uint32) int { func (c *defaultContext) GetProgramInfoLog(program uint32) string { bufSize := c.GetProgrami(program, INFO_LOG_LENGTH) + if bufSize == 0 { + return "" + } infoLog := make([]byte, bufSize) purego.SyscallN(c.gpGetProgramInfoLog, uintptr(program), uintptr(bufSize), 0, uintptr(unsafe.Pointer(&infoLog[0]))) return string(infoLog) @@ -313,6 +316,9 @@ func (c *defaultContext) GetProgrami(program uint32, pname uint32) int { func (c *defaultContext) GetShaderInfoLog(shader uint32) string { bufSize := c.GetShaderi(shader, INFO_LOG_LENGTH) + if bufSize == 0 { + return "" + } infoLog := make([]byte, bufSize) purego.SyscallN(c.gpGetShaderInfoLog, uintptr(shader), uintptr(bufSize), 0, uintptr(unsafe.Pointer(&infoLog[0]))) return string(infoLog)