Skip to content

Commit

Permalink
UPBGE: Fix crash with KX_2DFilter.setTexture
Browse files Browse the repository at this point in the history
@panzergame: I used if (!m_shader) return nullptr; to avoid the crash.
RAS_2DFilter::m_use is get/set with KX_2DFilter.enabled so I didn't use
OK()

Fixes #513

Thanks @hg1 for report!
  • Loading branch information
youle31 committed Jun 20, 2017
1 parent 403d19b commit 485afb0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions source/gameengine/Ketsji/KX_2DFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ KX_PYMETHODDEF_DOC(KX_2DFilter, setTexture, "setTexture(index, bindCode, sampler
if (!PyArg_ParseTuple(args, "ii|s:setTexture", &index, &bindCode, &samplerName)) {
return nullptr;
}
if (!m_shader) {
PyErr_SetString(PyExc_ValueError, "setTexture(index, bindCode, samplerName): KX_2DFilter, No valid shader found");
return nullptr;
}
if (index < 0 || index >= RAS_Texture::MaxUnits) {
PyErr_SetString(PyExc_ValueError, "setTexture(index, bindCode, samplerName): KX_2DFilter, index out of range [0, 7]");
return nullptr;
Expand Down

0 comments on commit 485afb0

Please sign in to comment.