cloud: fix rd_link_find_by_href to return proper link
@@ -77,8 +77,8 @@ static oc_link_t *
rd_link_find_by_href(oc_link_t *head, const char *href, size_t href_size)
{
oc_link_t *iter = head;
- while (iter != NULL && oc_string_len(iter->resource->uri) != href_size &&
- !strncmp(oc_string(iter->resource->uri), href, href_size)) {
+ while (iter != NULL && (oc_string_len(iter->resource->uri) != href_size ||
+ strncmp(oc_string(iter->resource->uri), href, href_size))) {
iter = iter->next;
}
return iter;
