Skip to content

Commit

Permalink
fix: properly handle case when spatial matcher receives estimated gue…
Browse files Browse the repository at this point in the history
…ss in feedback

fixes Invalid argument(s): match is not a SpatialGuess #18
  • Loading branch information
SPodjasek committed Jun 4, 2024
1 parent ee64c4a commit 7206342
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions packages/dart_zxcvbn/lib/src/matcher/spatial.dart
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,8 @@ class SpatialMatcher extends Matcher {

@override
Feedback? feedback(EstimatedGuessesMixin match, bool isSoleMatch) {
if (match is! SpatialGuess) {
throw ArgumentError('match is not a SpatialGuess');
}

String warning = zxcvbn.options.translations.warnings.keyPattern;
if (match.turns == 1) {
if (match is SpatialGuess && match.turns == 1) {
warning = zxcvbn.options.translations.warnings.straightRow;
}

Expand Down

0 comments on commit 7206342

Please sign in to comment.