Skip to content

Commit

Permalink
Crash if we cannot de/encode user
Browse files Browse the repository at this point in the history
  • Loading branch information
lbrndnr committed Jul 18, 2023
1 parent fd0e6da commit 422c5f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Nuage/NuageApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ struct NuageApp: App {

let defaults = UserDefaults.standard
if let data = defaults.data(forKey: userKey) {
SoundCloud.shared.user = try? JSONDecoder().decode(User.self, from: data)
SoundCloud.shared.user = try! JSONDecoder().decode(User.self, from: data)
}
let token = defaults.object(forKey: accessTokenKey)
let expiryDate = defaults.object(forKey: accessTokenExpiryDateKey)
Expand All @@ -124,7 +124,7 @@ struct NuageApp: App {

SoundCloud.shared.$user.sink { user in
if let user = user {
let data = try? JSONEncoder().encode(user)
let data = try! JSONEncoder().encode(user)
defaults.set(data, forKey: userKey)
}
else {
Expand Down

0 comments on commit 422c5f8

Please sign in to comment.