Skip to content

Commit

Permalink
Fix crash if prop file does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
DonnchaC committed Oct 31, 2024
1 parent 4a14c97 commit b21a7b1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/mvt/android/modules/androidqf/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,16 @@ def _get_device_timezone(self):
Android log files to UTC/timezone-aware timestamps.
"""
get_prop_files = self._get_files_by_pattern("*/getprop.txt")
prop_data = self._get_file_content(get_prop_files[0]).decode("utf-8")
if not get_prop_files:
self.log.warning(
"Could not find getprop.txt file. "
"Some timestamps and timeline data may be incorrect."
)
return None

from mvt.android.artifacts.getprop import GetProp

properties_artifact = GetProp()
prop_data = self._get_file_content(get_prop_files[0]).decode("utf-8")
properties_artifact.parse(prop_data)
timezone = properties_artifact.get_device_timezone()
if timezone:
Expand Down

0 comments on commit b21a7b1

Please sign in to comment.