diff --git a/camlibs/ptp2/ptp.c b/camlibs/ptp2/ptp.c index c465574e6..c08562d96 100644 --- a/camlibs/ptp2/ptp.c +++ b/camlibs/ptp2/ptp.c @@ -4942,8 +4942,11 @@ ptp_object_want (PTPParams *params, uint32_t handle, int want, PTPObject **retob saveparent = ob->oi.ParentObject; ret = ptp_getobjectinfo (params, handle, &ob->oi); - if (ret != PTP_RC_OK) + if (ret != PTP_RC_OK) { + /* kill it from the internal list ... */ + ptp_remove_object_from_cache(params, handle); return ret; + } if (!ob->oi.Filename) ob->oi.Filename=strdup(""); if (ob->flags & PTPOBJECT_PARENTOBJECT_LOADED) ob->oi.ParentObject = saveparent;