Skip to content

Commit 8253daf

Browse files
committed
Fix try..catch in pyJPEG::DecompressJPEG().
1 parent 8354800 commit 8253daf

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

Python/Util/pyJPEG.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,17 @@ PY_METHOD_STATIC_VA(JPEG, DecompressJPEG,
3737
return nullptr;
3838
}
3939

40-
plMipmap* mm = plJPEG::DecompressJPEG(((pyStream*)streamObj)->fThis);
41-
42-
// We're doing this manually because the new Mipmap object is being
43-
// released to Python code.
44-
pyMipmap* mmObj = nullptr;
40+
plMipmap* mm = nullptr;
4541
try {
46-
mmObj = PyObject_New(pyMipmap, &pyMipmap_Type);
42+
mm = plJPEG::DecompressJPEG(((pyStream*)streamObj)->fThis);
4743
} catch (const hsJPEGException& ex) {
4844
PyErr_SetString(PyExc_RuntimeError, ex.what());
4945
return nullptr;
5046
}
47+
48+
// We're doing this manually because the new Mipmap object is being
49+
// released to Python code.
50+
pyMipmap* mmObj = PyObject_New(pyMipmap, &pyMipmap_Type);
5151
mmObj->fPyOwned = true;
5252
mmObj->fThis = mm;
5353
return (PyObject*)mmObj;

0 commit comments

Comments
 (0)