diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index 3ce748b0..17894560 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -231,7 +231,7 @@ QPDFObjectHandle::disconnect() // Recursively remove association with any QPDF object. This method may only be called during // final destruction. QPDF::~QPDF() calls it for indirect objects using the object pointer // itself, so we don't do that here. Other objects call it through this method. - if (!isIndirect()) { + if (obj && !isIndirect()) { this->obj->disconnect(); } }