From 68d5ee95b3075afb843c9332a7bb44c4b94dd4be Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Wed, 18 Jul 2018 19:13:06 -0500 Subject: [PATCH] Add fix for decoding invalid user preferences --- src/invidious/helpers.cr | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/invidious/helpers.cr b/src/invidious/helpers.cr index 5734aa3a..ad36cf4e 100644 --- a/src/invidious/helpers.cr +++ b/src/invidious/helpers.cr @@ -119,7 +119,11 @@ end class User module PreferencesConverter def self.from_rs(rs) - Preferences.from_json(rs.read(String)) + begin + Preferences.from_json(rs.read(String)) + rescue ex + DEFAULT_USER_PREFERENCES + end end end