From b415dbd00a3bf9cef610c06e6d02bf396ef1bd4c Mon Sep 17 00:00:00 2001 From: Michael Gordeev Date: Wed, 12 Dec 2018 21:49:54 +0300 Subject: [PATCH] Crashing when there is no notifications.json file fixed --- FoxTube/Pages/MainPage.xaml.cs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/FoxTube/Pages/MainPage.xaml.cs b/FoxTube/Pages/MainPage.xaml.cs index 422011e..0b9d07d 100644 --- a/FoxTube/Pages/MainPage.xaml.cs +++ b/FoxTube/Pages/MainPage.xaml.cs @@ -122,13 +122,10 @@ namespace FoxTube public async void Initialize() { - if (await ApplicationData.Current.RoamingFolder.GetFileAsync("notifications.json") != null) - { - bool[] notificationsSettings = new bool[] { (bool)settings.Values["newVideoNotification"], (bool)settings.Values["devNews"] }; - await FileIO.WriteTextAsync( - await ApplicationData.Current.RoamingFolder.CreateFileAsync("notifications.json", CreationCollisionOption.ReplaceExisting), - JsonConvert.SerializeObject(notificationsSettings)); - } + bool[] notificationsSettings = new bool[] { (bool)settings.Values["newVideoNotification"], (bool)settings.Values["devNews"] }; + await FileIO.WriteTextAsync( + await ApplicationData.Current.RoamingFolder.CreateFileAsync("notifications.json", CreationCollisionOption.ReplaceExisting), + JsonConvert.SerializeObject(notificationsSettings)); } protected override void OnNavigatedTo(NavigationEventArgs e)