[Libreoffice-commits] online.git: loleaflet/src

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Tue Jul 7 08:17:17 UTC 2020


 loleaflet/src/map/Clipboard.js |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit ac7125b1ea4f451a4dfef0a7eed999e18ff0f51b
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Jul 7 09:52:04 2020 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue Jul 7 10:16:59 2020 +0200

    clipboard: avoid error when localStorage is not available
    
    In some browsers with strange settings localStorage is
    not available.
    
    Change-Id: If9e5ebeb9701cc0a2b19c5946bcbc23f76a8c577
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98238
    Tested-by: Jenkins
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/loleaflet/src/map/Clipboard.js b/loleaflet/src/map/Clipboard.js
index 39f5f6f10..31a459aa2 100644
--- a/loleaflet/src/map/Clipboard.js
+++ b/loleaflet/src/map/Clipboard.js
@@ -770,10 +770,13 @@ L.Clipboard = L.Class.extend({
 
 	_userAlreadyWarned: function (warning) {
 		var itemKey = warning;
-		if (!localStorage.getItem(itemKey)) {
-			localStorage.setItem(itemKey, '1');
+		var storage = localStorage;
+		if (storage && !storage.getItem(itemKey)) {
+			storage.setItem(itemKey, '1');
 			return false;
-		}
+		} else if (!storage)
+			return false;
+
 		return true;
 	},
 


More information about the Libreoffice-commits mailing list