Permalink
Browse files

Programação mais defensiva na exportação/importação.

  • Loading branch information...
1 parent f77d4c6 commit 264d9e0750667af79a1a339d57700cde90eda19c @erdavila committed Dec 16, 2011
Showing with 7 additions and 8 deletions.
  1. +7 −8 src/background/options.html
@@ -159,13 +159,10 @@
if(exportImportPanel.style.display == 'none') {
// Show
var str = '';
- for(key in localStorage) {
- if(key != "USER_OPTIONS") {
- if(str) {
- str += "\n";
- }
-
- str += key + ' ' + localStorage[key];
+ for(var key in localStorage) {
+ var val = localStorage[key];
+ if(key && key != "USER_OPTIONS" && val) {
+ str += key + ' ' + val + "\n";
}
}
exportImportData.value = str;
@@ -190,7 +187,9 @@
var parts = value.split(' ');
var key = parts[0];
var val = parts[1];
- localStorage[key] = val;
+ if(key && val) {
+ localStorage[key] = val;
+ }
}
alert("Os dados foram importados corretamente.");

0 comments on commit 264d9e0

Please sign in to comment.