refs #15 defensive check in restoreOptions

merge-requests/1/head
Julien Veyssier 2017-05-07 03:06:28 +02:00
parent a12552aae6
commit b37dad5ca6
1 changed files with 18 additions and 16 deletions

View File

@ -1280,22 +1280,24 @@
t('gpxedit', 'Error'));
});
optionsValues = $.parseJSON(optionsValues);
if ( optionsValues.markerstyle !== undefined
&& symbolIcons.hasOwnProperty(optionsValues.markerstyle)
) {
$('#markerstyleselect').val(optionsValues.markerstyle);
}
if (optionsValues.tooltipstyle !== undefined) {
$('#tooltipstyleselect').val(optionsValues.tooltipstyle);
}
if (optionsValues.clearbeforeload !== undefined) {
$('#clearbeforeload').prop('checked', optionsValues.clearbeforeload);
}
if (optionsValues.symboloverwrite !== undefined) {
$('#symboloverwrite').prop('checked', optionsValues.symboloverwrite);
}
if (optionsValues.tilelayer !== undefined) {
gpxedit.restoredTileLayer = optionsValues.tilelayer;
if (optionsValues) {
if ( optionsValues.markerstyle !== undefined
&& symbolIcons.hasOwnProperty(optionsValues.markerstyle)
) {
$('#markerstyleselect').val(optionsValues.markerstyle);
}
if (optionsValues.tooltipstyle !== undefined) {
$('#tooltipstyleselect').val(optionsValues.tooltipstyle);
}
if (optionsValues.clearbeforeload !== undefined) {
$('#clearbeforeload').prop('checked', optionsValues.clearbeforeload);
}
if (optionsValues.symboloverwrite !== undefined) {
$('#symboloverwrite').prop('checked', optionsValues.symboloverwrite);
}
if (optionsValues.tilelayer !== undefined) {
gpxedit.restoredTileLayer = optionsValues.tilelayer;
}
}
}