summaryrefslogtreecommitdiff
path: root/camlibs/ptp2/ptp.c
diff options
context:
space:
mode:
Diffstat (limited to 'camlibs/ptp2/ptp.c')
-rw-r--r--camlibs/ptp2/ptp.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/camlibs/ptp2/ptp.c b/camlibs/ptp2/ptp.c
index 90fc6b338..2f933bf85 100644
--- a/camlibs/ptp2/ptp.c
+++ b/camlibs/ptp2/ptp.c
@@ -7621,9 +7621,13 @@ ptp_object_want (PTPParams *params, uint32_t handle, unsigned int want, PTPObjec
ob->oi.ParentObject = 0;
/* Apple iOS X does that for the root folder. */
- if (ob->oi.ParentObject == ob->oi.StorageID) {
- ptp_debug (params, "parent %08x of %s has same id as storage id. rewriting to 0.", ob->oi.ParentObject, ob->oi.Filename);
- ob->oi.ParentObject = 0;
+ if ((ob->oi.ParentObject == ob->oi.StorageID)) {
+ PTPObject *parentob;
+
+ if (ptp_object_find (params, ob->oi.ParentObject, &parentob) != PTP_RC_OK) {
+ ptp_debug (params, "parent %08x of %s has same id as storage id. and no object found ... rewriting to 0.", ob->oi.ParentObject, ob->oi.Filename);
+ ob->oi.ParentObject = 0;
+ }
}
/* Read out the canon special flags */