yinwang0/rubysonar — pull request #2 by sqs (2014-01-07 03:48:29+00:00)
Title: Fix NPE in JSONDump

The following command yields an NPE:

```
$ java -cp target/rubysonar-0.1-SNAPSHOT.jar org.yinwang.rubysonar.JSONDump tests/include.test/include.rb '' foo
copied models to: /tmp/pysonar2/models.f4a382bb-d4d8-4fdc-b00b-ea52ce1eb932
AST cache is at: /tmp/rubysonar/ast_cache
started: irb
100% (1 of 1) SPEED: 0/s AVG SPEED: 500/s ETA: 0:0:0
Finished loading files. 2 functions were called.
Analyzing uncalled functions

---------------- analysis summary ----------------
- total time: 0:0:0
- modules loaded: 1
- semantic problems: 1
- failed to parse: 0
- number of definitions: 6
- number of cross references: 6
- number of references: 6
- resolved names: 4
- unresolved names: 3
- name resolve rate: 57%
---------------- memory stats ----------------
- total collections: 0
- total collection time: 0:0:0
- total memory: 360.06M
Exception in thread "main" java.lang.NullPointerException
at org.yinwang.rubysonar.JSONDump.writeSymJson(JSONDump.java:107)
at org.yinwang.rubysonar.JSONDump.graph(JSONDump.java:229)
at org.yinwang.rubysonar.JSONDump.main(JSONDump.java:292)
```

This patch fixes it. There might be more that needs to change; I'm not sure.