Fix #2450 (Crash on send to PRS-700)

This commit is contained in:
Kovid Goyal 2009-05-15 21:22:31 -07:00
parent 4f62582882
commit c331252d14

View File

@ -48,10 +48,12 @@ podofo_PDFDoc_load(podofo_PDFDoc *self, PyObject *args, PyObject *kwargs) {
try { try {
self->doc->Load(buffer, size); self->doc->Load(buffer, size);
} catch(const PdfError & err) { } catch(const PdfError & err) {
PyErr_SetString(PyExc_ValueError, PdfError::ErrorMessage(err.GetError())); const char *msg = PdfError::ErrorMessage(err.GetError());
if (msg == NULL) msg = err.what();
PyErr_SetString(PyExc_ValueError, msg);
return NULL; return NULL;
} }
} else return NULL; } else return NULL;
Py_INCREF(Py_None); Py_INCREF(Py_None);