@@ -335,14 +335,13 @@ static void on_secure_node_info_no_response(attribute_store_node_t secure_nif_no
335335 uint8_t nif [ZWAVE_CONTROLLER_MAXIMUM_COMMAND_CLASS_LIST_LENGTH ];
336336 uint8_t nif_length = 0 ;
337337
338- if (SL_STATUS_OK
339- == attribute_store_get_node_attribute_value (secure_nif_node ,
340- REPORTED_ATTRIBUTE ,
341- nif ,
342- & nif_length )) {
343- if (nif_length != 0 ) {
338+ if (( SL_STATUS_OK
339+ == attribute_store_get_node_attribute_value (secure_nif_node ,
340+ REPORTED_ATTRIBUTE ,
341+ nif ,
342+ & nif_length ))
343+ && (nif_length != 0 ) ) {
344344 return ;
345- }
346345 }
347346
348347 sl_log_warning (LOG_TAG , "Failed to get Secure NIF Attribute ID %d" , secure_nif_node );
@@ -371,30 +370,31 @@ static void on_secure_node_info_no_response(attribute_store_node_t secure_nif_no
371370 }
372371
373372 // If Multi Channel endpoint
374- if (endpoint_id > 0 ) {
375- attribute_store_node_t non_secure_nif_node
373+ if (endpoint_id <= 0 ) {
374+ return ;
375+ }
376+ attribute_store_node_t non_secure_nif_node
376377 = attribute_store_get_first_child_by_type (endpoint_id_node ,
377378 ATTRIBUTE_ZWAVE_NIF );
378379
379- if ((non_secure_nif_node != ATTRIBUTE_STORE_INVALID_NODE )
380- && (SL_STATUS_OK
381- == attribute_store_get_node_attribute_value (non_secure_nif_node ,
382- REPORTED_ATTRIBUTE ,
383- nif ,
384- & nif_length ))) {
385- uint8_t j = 0 ;
386- for (uint8_t i = 0 ; i < nif_length ; i ++ ) {
387- if (nif [i ] != COMMAND_CLASS_SECURITY && nif [i ] != COMMAND_CLASS_SECURITY_2 ) {
388- nif [j ++ ] = nif [i ];
389- }
380+ if ((non_secure_nif_node != ATTRIBUTE_STORE_INVALID_NODE )
381+ && (SL_STATUS_OK
382+ == attribute_store_get_node_attribute_value (non_secure_nif_node ,
383+ REPORTED_ATTRIBUTE ,
384+ nif ,
385+ & nif_length ))) {
386+ uint8_t j = 0 ;
387+ for (uint8_t i = 0 ; i < nif_length ; i ++ ) {
388+ if (nif [i ] != COMMAND_CLASS_SECURITY && nif [i ] != COMMAND_CLASS_SECURITY_2 ) {
389+ nif [j ++ ] = nif [i ];
390390 }
391- nif_length = j ;
392-
393- // The implicit rule that all non-secure command classes for an End Point
394- // must be controllable securely is still in effect,
395- // if the endpoint is reported secure.
396- attribute_store_set_reported (secure_nif_node , nif , nif_length );
397391 }
392+ nif_length = j ;
393+
394+ // The implicit rule that all non-secure command classes for an End Point
395+ // must be controllable securely is still in effect,
396+ // if the endpoint is reported secure.
397+ attribute_store_set_reported (secure_nif_node , nif , nif_length );
398398 }
399399}
400400
0 commit comments