Qt: Fix crash if loading a shader fails

This commit is contained in:
Vicki Pfau 2023-03-01 16:10:43 -08:00
parent 7ffa0ff280
commit e504ac3665
2 changed files with 4 additions and 2 deletions

View File

@ -22,6 +22,7 @@ Other fixes:
- Qt: Fix modifier key names in shortcut editor (fixes mgba.io/i/2817)
- Qt: Fix a handful of edge cases with graphics viewers (fixes mgba.io/i/2827)
- Qt: Fix full-buffer rewind
- Qt: Fix crash if loading a shader fails
- Scripting: Fix receiving packets for client sockets
- Scripting: Fix empty receive calls returning unknown error on Windows
Misc:

View File

@ -915,8 +915,9 @@ void PainterGL::setShaders(struct VDir* dir) {
mGLES2ShaderDetach(reinterpret_cast<mGLES2Context*>(m_backend));
mGLES2ShaderFree(&m_shader);
}
mGLES2ShaderLoad(&m_shader, dir);
mGLES2ShaderAttach(reinterpret_cast<mGLES2Context*>(m_backend), static_cast<mGLES2Shader*>(m_shader.passes), m_shader.nPasses);
if (mGLES2ShaderLoad(&m_shader, dir)) {
mGLES2ShaderAttach(reinterpret_cast<mGLES2Context*>(m_backend), static_cast<mGLES2Shader*>(m_shader.passes), m_shader.nPasses);
}
if (!m_started) {
m_gl->doneCurrent();