Fix crash when ReportView opened before instance loaded

This commit is contained in:
Shadowfacts 2023-02-24 18:32:29 -05:00
parent daf3741c9a
commit 76550d8fb8
1 changed files with 2 additions and 2 deletions

View File

@ -23,7 +23,7 @@ struct ReportView: View {
self.account = mastodonController.persistentContainer.account(for: report.accountID)! self.account = mastodonController.persistentContainer.account(for: report.accountID)!
self.mastodonController = mastodonController self.mastodonController = mastodonController
self._report = StateObject(wrappedValue: report) self._report = StateObject(wrappedValue: report)
if mastodonController.instance.rules == nil { if mastodonController.instance?.rules == nil {
report.reason = .spam report.reason = .spam
} }
} }
@ -77,7 +77,7 @@ struct ReportView: View {
} }
} }
if mastodonController.instance.rules != nil { if mastodonController.instance?.rules != nil {
NavigationLink { NavigationLink {
ReportSelectRulesView(mastodonController: mastodonController, report: report) ReportSelectRulesView(mastodonController: mastodonController, report: report)
} label: { } label: {