Friendly error in get_location_list_at_offset (#492)
[pyelftools.git] / elftools / dwarf / locationlists.py
index 243834fee0ab89024637e0ae0d18e8b30f0c00bc..9a349779baa02eecf260f846392a2edcd50aa65b 100644 (file)
@@ -92,6 +92,8 @@ class LocationLists(object):
         Passing the die is only neccessary in DWARF5+, for decoding
         location entry encodings that contain references to other sections.
         """
+        if self.version >= 5 and die is None:
+            raise DWARFError("For this binary, \"die\" needs to be provided")              
         self.stream.seek(offset, os.SEEK_SET)
         return self._parse_location_list_from_stream_v5(die.cu) if self.version >= 5 else self._parse_location_list_from_stream()