Commit 86183499 authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

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: default avatarUlf Hermann <ulf.hermann@qt.io>
Reviewed-by: default avatarPaul Wicking <paul.wicking@qt.io>
Showing with 3 additions and 2 deletions
......@@ -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) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment