From b31e126b3fd2fcf7235e2c5f6f4453369fecbf05 Mon Sep 17 00:00:00 2001 From: Timo Nachstedt <mail@nachstedt.com> Date: Sun, 26 Apr 2020 23:13:22 +0200 Subject: [PATCH] Ensure process is defined in version check To allow for user agents which contain "electron" within their name but do not run within a node.js context, we need to check if the process object is defined at all before accessing its properties. In particular, this is required to run diagrams.net within a Visual Studio Code webview extension. --- src/main/webapp/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/webapp/index.html b/src/main/webapp/index.html index 29c3bf791..fe2ca6303 100644 --- a/src/main/webapp/index.html +++ b/src/main/webapp/index.html @@ -392,7 +392,7 @@ * Main */ if (navigator.userAgent != null && navigator.userAgent.toLowerCase(). - indexOf(' electron/') >= 0 && process.versions.electron < 5) + indexOf(' electron/') >= 0 && typeof process !== 'undefined' && process.versions.electron < 5) { // Redirects old Electron app to latest version var div = document.getElementById('geInfo'); -- GitLab