Added better error handling and gracefully handle NPE
Added better error handling and gracefully handle NPE

Fixes #817

Signed-off-by: Chris Larsen <83037b211e1d109d6858769a113e269c3139ffd3@yahoo-inc.com>

OpenTSDB/opentsdb,MadDogTechnology/opentsdb,alienth/opentsdb,MadDogTechnology/opentsdb,OpenTSDB/opentsdb,OpenTSDB/opentsdb,alienth/opentsdb,MadDogTechnology/opentsdb