vinhkhuc / JFastText

Java interface for fastText
Other
228 stars 100 forks source link

NullPointerException :: Code Correction #32

Open ashuezy opened 6 years ago

ashuezy commented 6 years ago

Demo example will sooner or later lead to NullPointerException

JFastText.ProbLabel probLabel = jft.predictProba(entireData);//This is bound to throw NullPointerException

replace it with

List predictionList = jft.predictProba(entireData, 1); if(predictionList.size()>0)//check the size of output before fetching an item {

}