@canboat/canboatjs 1.26.2 → 1.26.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/fromPgn.js +14 -10
  2. package/package.json +1 -1
package/lib/fromPgn.js CHANGED
@@ -738,17 +738,21 @@ function readVariableLengthField(options, pgn, field, bs) {
738
738
  * length and thus that the field number is exactly one byte earlier.
739
739
  */
740
740
 
741
- var refField = getField(pgn.fields.PGN, bs.view.buffer[bs.byteIndex-1]-1, pgn)
742
-
743
- if ( refField ) {
744
- var bits = (refField.BitLength + 7) & ~7; // Round # of bits in field refField up to complete bytes: 1->8, 7->8, 8->8 etc.
745
- let res = readField(options, false, pgn, refField, bs)
746
-
747
- if ( bits > refField.BitLength ) {
748
- bs.readBits(bits - refField.BitLength, false)
741
+ try {
742
+ var refField = getField(pgn.fields.PGN, bs.view.buffer[bs.byteIndex-1]-1, pgn)
743
+
744
+ if ( refField ) {
745
+ var bits = (refField.BitLength + 7) & ~7; // Round # of bits in field refField up to complete bytes: 1->8, 7->8, 8->8 etc.
746
+ let res = readField(options, false, pgn, refField, bs)
747
+
748
+ if ( bits > refField.BitLength ) {
749
+ bs.readBits(bits - refField.BitLength, false)
750
+ }
751
+
752
+ return res
749
753
  }
750
-
751
- return res
754
+ } catch ( error ) {
755
+ debug(error)
752
756
  }
753
757
  }
754
758
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canboat/canboatjs",
3
- "version": "1.26.2",
3
+ "version": "1.26.3",
4
4
  "description": "Native javascript version of canboat",
5
5
  "main": "index.js",
6
6
  "scripts": {