/*
- * Copyright (C) 2010-2014 jeanfi@gmail.com
+ * Copyright (C) 2010-2016 jeanfi@gmail.com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
char *str;
json_object *obj = json_object_new_array();
- sensors_cur = sensors;
+ if (sensors) {
+ sensors_cur = sensors;
- while (*sensors_cur) {
- struct psensor *s = *sensors_cur;
+ while (*sensors_cur) {
+ struct psensor *s = *sensors_cur;
- json_object_array_add(obj, sensor_to_json(s));
+ json_object_array_add(obj, sensor_to_json(s));
- sensors_cur++;
+ sensors_cur++;
+ }
}
str = strdup(json_object_to_json_string(obj));