@@ -128,7 +128,6 @@ class DocumentViewController: UIViewController, DocumentDelegate {
128128 } else {
129129 closeCurrentDocument ( )
130130 }
131-
132131 }
133132
134133 func closeCurrentDocument( ) {
@@ -146,7 +145,6 @@ class DocumentViewController: UIViewController, DocumentDelegate {
146145 } else {
147146 self . dismiss ( animated: true , completion: nil )
148147 }
149-
150148 }
151149 }
152150
@@ -195,16 +193,18 @@ class DocumentViewController: UIViewController, DocumentDelegate {
195193 }
196194
197195 func saveContent( ) {
198- if let URL = document? . fileURL {
199- document? . save ( to: URL, for: . forOverwriting) { success in
200- if success {
201- self . showToast ( controller: self , message: " Successfully saved " , seconds: 1 , color: . green)
202- } else {
203- self . showToast ( controller: self , message: " Error while saving " , seconds: 1 , color: . red)
204- }
205-
196+ guard let doc = document else {
197+ Crashlytics . sharedInstance ( ) . throwException ( )
198+
199+ return
200+ }
201+
202+ doc. save ( to: doc. fileURL, for: . forOverwriting) { success in
203+ if success {
204+ self . showToast ( controller: self , message: " Successfully saved " , seconds: 1 , color: . green)
205+ } else {
206+ self . showToast ( controller: self , message: " Error while saving " , seconds: 1 , color: . red)
206207 }
207-
208208 }
209209 }
210210
@@ -220,7 +220,6 @@ class DocumentViewController: UIViewController, DocumentDelegate {
220220
221221 completion ? ( )
222222 }
223-
224223 }
225224
226225 func editDocument( ) {
0 commit comments