aichaos / rivescript-java

A RiveScript interpreter for Java. RiveScript is a scripting language for chatterbots.
http://www.rivescript.com
MIT License
64 stars 38 forks source link

NPE optional array #20

Closed UshakovVasilii closed 7 years ago

UshakovVasilii commented 8 years ago

RS file:

! version = 2.0

+ [(a|b) ](c|d)
- <star2>

input c

java.lang.NullPointerException
    at com.rivescript.Util.Sv2s(Util.java:52) ~[rivescript-core-0.7.0-SNAPSHOT.jar:?]
    at com.rivescript.RiveScript.processTags(RiveScript.java:1690) ~[rivescript-core-0.7.0-SNAPSHOT.jar:?]
    at com.rivescript.RiveScript.reply(RiveScript.java:1511) ~[rivescript-core-0.7.0-SNAPSHOT.jar:?]
    at com.rivescript.RiveScript.reply(RiveScript.java:1062) ~[rivescript-core-0.7.0-SNAPSHOT.jar:?]
marceloverdijk commented 7 years ago

Instead of adding a null star to the array, we now add an empty String "".