From 4f421ffbfea9914665527c52f476510c748240f0 Mon Sep 17 00:00:00 2001 From: Yurii Cherniavskyi Date: Fri, 13 Sep 2019 19:02:37 +0300 Subject: [PATCH] fix(application-settings-android): possible uninitialized sharedPreferences variable usage (#7813) --- .../application-settings/application-settings.android.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tns-core-modules/application-settings/application-settings.android.ts b/tns-core-modules/application-settings/application-settings.android.ts index c042208c5f..aaa09074ea 100644 --- a/tns-core-modules/application-settings/application-settings.android.ts +++ b/tns-core-modules/application-settings/application-settings.android.ts @@ -85,10 +85,13 @@ export function clear(): void { } export function flush(): boolean { + ensureSharedPreferences(); + return sharedPreferences.edit().commit(); } export function getAllKeys(): Array { + ensureSharedPreferences(); const mappedPreferences = sharedPreferences.getAll(); const iterator = mappedPreferences.keySet().iterator(); const result = [];