Skip to content

Commit 0eb1f6a

Browse files
committed
prevent duplicate lookup when searching for verification algorithm
1 parent e516be9 commit 0eb1f6a

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
@@ -3723,11 +3723,12 @@ namespace jwt {
37233723
}
37243724

37253725
if (!key_found) {
3726-
if (algs.count(algo) == 0) {
3726+
auto alg = algs.find(algo);
3727+
if (alg == algs.end()) {
37273728
ec = error::token_verification_error::wrong_algorithm;
37283729
return;
37293730
}
3730-
algs.at(algo)->verify(data, sig, ec);
3731+
alg->second->verify(data, sig, ec);
37313732
}
37323733

37333734
if (ec) return;

0 commit comments

Comments
 (0)