From e6bbe74f74c19ac9de7421b60715b5f0a41192f7 Mon Sep 17 00:00:00 2001 From: Quentin DECAUNES Date: Tue, 30 Jul 2019 16:45:59 +0200 Subject: [PATCH] Fixes RYZEN-CONTROLLER-30 - Unable to detect malformed data in some cases. --- js/preset.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/js/preset.js b/js/preset.js index 2c41be6..f3cbe88 100644 --- a/js/preset.js +++ b/js/preset.js @@ -17,9 +17,10 @@ function preset_import() { const modalTextArea = document.getElementById('modal-import-preset-textarea'); const settings = require('electron-settings'); var currentPresets = settings.get('presets'); - var presetsToBeImported = atob(modalTextArea.value); - + var presetsToBeImported; + try { + presetsToBeImported = atob(modalTextArea.value); presetsToBeImported = JSON.parse(presetsToBeImported); } catch (e) { notification('danger', 'Unable to import presets, malformed data.');