From ebc24b5c9750506255b526d81672894fa4800795 Mon Sep 17 00:00:00 2001
From: Tamas Gal <tgal@km3net.de>
Date: Wed, 2 Dec 2020 15:13:22 +0100
Subject: [PATCH] Fall back to object itself if index_chain is empty

---
 km3io/tools.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/km3io/tools.py b/km3io/tools.py
index 85653c7..2f62aeb 100644
--- a/km3io/tools.py
+++ b/km3io/tools.py
@@ -30,6 +30,8 @@ class cached_property:
 
 def unfold_indices(obj, indices):
     """Unfolds an index chain and returns the corresponding item"""
+    if not indices:
+        return obj
     original_obj = obj
     for depth, idx in enumerate(indices):
         try:
-- 
GitLab