diff --git a/src/apps/snmp/snmp_threadsync.c b/src/apps/snmp/snmp_threadsync.c index cfcfb274..6947c52f 100644 --- a/src/apps/snmp/snmp_threadsync.c +++ b/src/apps/snmp/snmp_threadsync.c @@ -55,7 +55,11 @@ threadsync_get_value_synced(void *ctx) { struct threadsync_data *call_data = (struct threadsync_data *)ctx; - call_data->retval.s16 = call_data->proxy_instance.get_value(&call_data->proxy_instance, call_data->arg1.value); + if (call_data->proxy_instance.get_value != NULL) { + call_data->retval.s16 = call_data->proxy_instance.get_value(&call_data->proxy_instance, call_data->arg1.value); + } else { + call_data->retval.s16 = -1; + } sys_sem_signal(&call_data->threadsync_node->instance->sem); } @@ -76,7 +80,11 @@ threadsync_set_test_synced(void *ctx) { struct threadsync_data *call_data = (struct threadsync_data *)ctx; - call_data->retval.err = call_data->proxy_instance.set_test(&call_data->proxy_instance, call_data->arg2.len, call_data->arg1.value); + if (call_data->proxy_instance.set_test != NULL) { + call_data->retval.err = call_data->proxy_instance.set_test(&call_data->proxy_instance, call_data->arg2.len, call_data->arg1.value); + } else { + call_data->retval.err = SNMP_ERR_NOSUCHINSTANCE; + } sys_sem_signal(&call_data->threadsync_node->instance->sem); } @@ -98,7 +106,11 @@ threadsync_set_value_synced(void *ctx) { struct threadsync_data *call_data = (struct threadsync_data *)ctx; - call_data->retval.err = call_data->proxy_instance.set_value(&call_data->proxy_instance, call_data->arg2.len, call_data->arg1.value); + if (call_data->proxy_instance.set_value != NULL) { + call_data->retval.err = call_data->proxy_instance.set_value(&call_data->proxy_instance, call_data->arg2.len, call_data->arg1.value); + } else { + call_data->retval.err = SNMP_ERR_NOSUCHINSTANCE; + } sys_sem_signal(&call_data->threadsync_node->instance->sem); }