diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-04-17 13:23:13 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-04-23 07:23:14 +0000 |
commit | 86183499a736ca48df99025e5b60b68a72b62fc9 (patch) | |
tree | 440b323802a51e88cd328e718b570bfb5f169ee2 | |
parent | 52064e378c5848ae866180b3cf2f399a11b1617a (diff) | |
download | qtdoc-86183499a736ca48df99025e5b60b68a72b62fc9.tar.gz |
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 <ulf.hermann@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
-rw-r--r-- | examples/demos/photoviewer/PhotoViewerCore/script/script.mjs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/demos/photoviewer/PhotoViewerCore/script/script.mjs b/examples/demos/photoviewer/PhotoViewerCore/script/script.mjs index 1eb7cac7..a1822197 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) { |