summaryrefslogtreecommitdiffstats
path: root/examples/demos/photoviewer/PhotoViewerCore
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-04-17 13:23:13 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-04-23 07:23:14 +0000
commit86183499a736ca48df99025e5b60b68a72b62fc9 (patch)
tree440b323802a51e88cd328e718b570bfb5f169ee2 /examples/demos/photoviewer/PhotoViewerCore
parent52064e378c5848ae866180b3cf2f399a11b1617a (diff)
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>
Diffstat (limited to 'examples/demos/photoviewer/PhotoViewerCore')
-rw-r--r--examples/demos/photoviewer/PhotoViewerCore/script/script.mjs5
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 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) {