marchyman / GeoTag

Image geo location editing for macOS Ventura (13) and later. Instructions and a .dmg of the current version are on the application home page.
https://www.snafu.org/GeoTag/
MIT License
131 stars 14 forks source link

Crash when saving photo with "Update GPS Date/Time" ticked #51

Closed SFrost007 closed 5 months ago

SFrost007 commented 5 months ago

I have a load of images with no "Timestamp" property (created by the Plustek Z300 photo scanner). I found that when adding GPS tags to these photos the app would crash when I hit Cmd+S. I cloned the repo, built the app myself and the cause seems fairly clear/reproducible, but I don't know your codebase well enough to know how you'd want to fix it. Hopefully this helps identify the bug at least 🙂

  1. Exiftool.swift:L127 tries to get the gpsTimestamp for the photo
  2. Exiftool.swift:L172 returns an empty string because dateTimeCreated is nil
  3. Exiftool.swift:L134 attempts to split that empty string and gets an empty array
  4. Exiftool.swift:L135 attempts to access index 0 of the empty array and gets Index out of range

I don't necessarily need to update the GPS date, I was just trying out the new options after updating the app for the first time in a while. And from hitting the crash through Xcode and finding the cause I realised I can avoid it by unticking that option in preferences (or manually saving a date to the photo first from the info inspector pane). I just wanted to raise it in case it helps highlight any other crash reports you've had - if it helps I can send you an example photo in this state?

Thanks for all the work you've put into this app, I've been using it for years to keep my photo library tidy!

marchyman commented 5 months ago

Wow. Thank you. I wish all bug reports told me exactly what and where the bug is.

As there is no timestamp it is foolish (I think) to try to update the GPS version. The code would be asking "what is the GMT version of nothing?". The fix will be in the next dot release, tentatively scheduled for mid-June. That release will be bug fixes only, no new features.

Thanks again.

marchyman commented 5 months ago

Change is in the "fixes" branch. It will be merged into main when ready for release.

It's going to take me longer to test than make the fix :)