Fixed NullPointerException if null cursor is passed