artasparks / gpub

GPub: Go Publishing for Glift
MIT License
16 stars 3 forks source link

Multiple SGF files with identical GN properties causes an error #26

Closed dormerod closed 8 years ago

dormerod commented 8 years ago

If book_gen.js is run on multiple SGFs (e.g. within a directory), and any of them have duplicate GN properties, it causes an error with the following output:

/gpub/src/glift/glift_combined.js:8047
    return this.node().properties();
                      ^
TypeError: Cannot read property 'properties' of null
    at Object.glift.rules._MoveTree.properties (/gpub/src/glift/glift_combined.js:8047:23)
    at Object.glift.rules.treepath.applyNextMoves (/gpub/src/glift/glift_combined.js:9299:21)
    at Object.glift.flattener.flatten [as flatten] (/gpub/src/glift/glift_combined.js:11219:40)
    at Object.gpub.book._Generator.forEachSgf (/gpub/src/compiled/gpub_combined.js:952:39)
    at Object.gpub.book.latex.generator.generate (/gpub/src/compiled/gpub_combined.js:1436:10)
    at Object.gpub.book.create (/gpub/src/compiled/gpub_combined.js:717:16)
    at Object.gpub.create (/gpub/src/compiled/gpub_combined.js:3118:24)
    at Object.<anonymous> (/gpub/scripts/book_gen.js:100:17)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)

Note that this doesn't happen when GN is null in multiple files.