Skip to content

Commit 1dfa829

Browse files
committed
Fix unhandled exception when getting the HDU data fails (typically in the case of the file being truncated; see astropy#541)
git-svn-id: http://svn6.assembla.com/svn/pyfits/trunk@2265 ed100bfc-0583-0410-97f2-c26b58777a21
1 parent c1c45da commit 1dfa829

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎astropy/io/fits/src/compressionmodule.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,9 @@ PyObject* compression_decompress_hdu(PyObject* self, PyObject* args)
971971
// Grab a pointer to the input data from the HDU's compressed_data
972972
// attribute
973973
get_hdu_data_base(hdu, &inbuf, &inbufsize);
974+
if (PyErr_Occurred()) {
975+
return NULL;
976+
}
974977

975978
open_from_hdu(&fileptr, &inbuf, &inbufsize, hdu, columns);
976979
if (PyErr_Occurred()) {

0 commit comments

Comments
 (0)