OCStackResult OCSetAttribute(OCResource* resource, const char* attribute, const void* value)
{
// See if the attribute already exists in the list.
- OCAttribute *resAttrib;
+ OCAttribute *resAttrib = NULL;
for (resAttrib = resource->rsrcAttributes; resAttrib; resAttrib = resAttrib->next)
{
if (0 == strcmp(attribute, resAttrib->attrName))
OCStackResult OCSetPropertyValue(OCPayloadType type, const char *prop, const void *value)
{
- if (!prop)
+ if (!prop || !value)
{
return OC_STACK_INVALID_PARAM;
}
{
OIC_LOG(ERROR, TAG, "Resource does not exist.");
}
- if (value)
+ else
{
res = OCSetAttribute(resource, prop, value);
}