From db860b5907bbffb4e284f8b45ba79d7caf168fb8 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 29 Dec 2019 16:42:20 +0100 Subject: [PATCH] fix semi-deterministic bug with link parser --- src/common/LinkParser.cpp | 15 ++++++--------- src/common/LinkParser.hpp | 2 +- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/common/LinkParser.cpp b/src/common/LinkParser.cpp index 20efdc2ab..18c3a29a7 100644 --- a/src/common/LinkParser.cpp +++ b/src/common/LinkParser.cpp @@ -170,19 +170,16 @@ parseAnchor: done: // check host - if (this->hasMatch_) - { - this->hasMatch_ = isValidHostname(host) || isValidIpv4(host) + this->hasMatch_ = isValidHostname(host) || isValidIpv4(host) #ifdef C_MATCH_IPV6_LINK - || (hasHttp && isValidIpv6(host)) + || (hasHttp && isValidIpv6(host)) #endif - ; + ; - if (this->hasMatch_) - { - this->match_ = unparsedString; - } + if (this->hasMatch_) + { + this->match_ = unparsedString; } return; diff --git a/src/common/LinkParser.hpp b/src/common/LinkParser.hpp index d72e1139c..907d22a80 100644 --- a/src/common/LinkParser.hpp +++ b/src/common/LinkParser.hpp @@ -14,7 +14,7 @@ public: QString getCaptured() const; private: - bool hasMatch_; + bool hasMatch_{false}; QString match_; };