From 86183499a736ca48df99025e5b60b68a72b62fc9 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 17 Apr 2019 13:23:13 +0200 Subject: Photoviewer: Fix warnings flood Accept https and check for the match of the regexp, fixing: rc:/PhotoViewerCore/script/script.mjs:61: TypeError: Cannot read property '1' of null qrc:/PhotoViewerCore/script/script.mjs:61: TypeError: Cannot read property '1' of null qrc:/PhotoViewerCore/script/script.mjs:61: TypeError: Cannot read property '1' of null qrc:/PhotoViewerCore/script/script.mjs:61: TypeError: Cannot read property '1' of null qrc:/PhotoViewerCore/script/script.mjs:61: TypeError: Cannot read property '1' of null qrc:/PhotoViewerCore/script/script.mjs:61: TypeError: Cannot read property '1' of null Fixes: QTBUG-75255 Change-Id: I3c447830874d504213276b8064abcf3cef1f72ec Reviewed-by: Ulf Hermann Reviewed-by: Paul Wicking --- examples/demos/photoviewer/PhotoViewerCore/script/script.mjs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'examples/demos/photoviewer/PhotoViewerCore') diff --git a/examples/demos/photoviewer/PhotoViewerCore/script/script.mjs b/examples/demos/photoviewer/PhotoViewerCore/script/script.mjs index 1eb7cac7e..a1822197b 100644 --- a/examples/demos/photoviewer/PhotoViewerCore/script/script.mjs +++ b/examples/demos/photoviewer/PhotoViewerCore/script/script.mjs @@ -57,8 +57,9 @@ export function getHeight(string) { } export function getImagePath(string) { - var pattern = /src=\"http:\/\/(\S+)\"/ - return (string.match(pattern))[1] + var pattern = /src=\"https?:\/\/(\S+)\"/ + var match = string.match(pattern) + return match ? match[1] : "" } export function calculateScale(width, height, cellSize) { -- cgit v1.2.3