Skip to content

Commit 913f95c

Browse files
committed
prevent duplicate lookup when searching for verification algorithm
1 parent dc5c066 commit 913f95c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

include/jwt-cpp/jwt.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3835,11 +3835,12 @@ namespace jwt {
38353835
}
38363836

38373837
if (!key_found) {
3838-
if (algs.count(algo) == 0) {
3838+
auto alg = algs.find(algo);
3839+
if (alg == algs.end()) {
38393840
ec = error::token_verification_error::wrong_algorithm;
38403841
return;
38413842
}
3842-
algs.at(algo)->verify(data, sig, ec);
3843+
alg->second->verify(data, sig, ec);
38433844
}
38443845

38453846
if (ec) return;

0 commit comments

Comments
 (0)