Fixes RYZEN-CONTROLLER-30 - Unable to detect malformed data in some cases.

This commit is contained in:
Quentin DECAUNES 2019-07-30 16:45:59 +02:00
parent d99511a423
commit e6bbe74f74

View File

@ -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.');