Skip to content

Commit

Permalink
decode: Fix invalid deckstring version message
Browse files Browse the repository at this point in the history
  • Loading branch information
beheh committed May 31, 2017
1 parent a76c739 commit f1051e1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- encode: Skip counts with 0
- encode: Verify parameters more strictly

### Fixed
- decode: Fix invalid deckstring version message

## [0.1.1] - 2017-05-25
### Added
- Changelog (http://keepachangelog.com/)
Expand Down
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ export function decode(deckstring: string): DeckDefinition {
throw new Error("Invalid deckstring");
}

if (reader.nextVarint() !== DECKSTRING_VERSION) {
throw new Error(`Unsupported deckstring version {$version}`);
const version = reader.nextVarint();
if (version !== DECKSTRING_VERSION) {
throw new Error(`Unsupported deckstring version ${version}`);
}

const format = reader.nextVarint();
Expand Down

0 comments on commit f1051e1

Please sign in to comment.