Fixed uncaught exception when there is no QBO connection

This commit is contained in:
2026-03-14 17:27:01 -04:00
parent 6fc8a18e93
commit a6c8923ea9

View File

@@ -27,8 +27,9 @@ class Qbo < ActiveRecord::Base
# Returns the last sync time formatted for display. If no sync has occurred, returns a default message. # Returns the last sync time formatted for display. If no sync has occurred, returns a default message.
def self.last_sync def self.last_sync
qbo = QboConnectionService.current! qbo = QboConnectionService.current!
return I18n.t(:label_qbo_never_synced) unless qbo&.last_sync
format_time(qbo.last_sync) format_time(qbo.last_sync)
rescue
return I18n.t(:label_qbo_never_synced)
end end
private private