Commit 0308207f authored by jihwan.seo's avatar jihwan.seo Committed by Habib Virji

fix crash issue related set interfaceQuery.

Change-Id: I7c40c0930879a0ad860e935325adc44b860d9ee8
Signed-off-by: default avatarjihwan.seo <jihwan.seo@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/14371Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: default avatarUze Choi <uzchoi@samsung.com>
Reviewed-by: default avatarHabib Virji <habib.virji@samsung.com>
parent 67d18dff
......@@ -809,31 +809,34 @@ static OCStackResult HandleVirtualResource (OCServerRequest *request, OCResource
}
bool baselineQuery = false;
if (0 != strcmp(interfaceQuery, OC_RSRVD_INTERFACE_LL))
if (interfaceQuery && 0 != strcmp(interfaceQuery, OC_RSRVD_INTERFACE_LL))
{
baselineQuery = true;
}
if (interfaceQuery)
discoveryResult = discoveryPayloadCreateAndAddDeviceId(&payload);
VERIFY_PARAM_NON_NULL(TAG, payload, "Failed creating Discovery Payload.");
VERIFY_SUCCESS(discoveryResult, OC_STACK_OK);
OCDiscoveryPayload *discPayload = (OCDiscoveryPayload *)payload;
if (baselineQuery)
{
discoveryResult = discoveryPayloadCreateAndAddDeviceId(&payload);
VERIFY_PARAM_NON_NULL(TAG, payload, "Failed creating Discovery Payload.");
discoveryResult = addDiscoveryBaselineCommonProperties(discPayload);
VERIFY_SUCCESS(discoveryResult, OC_STACK_OK);
OCDiscoveryPayload *discPayload = (OCDiscoveryPayload *)payload;
if (baselineQuery)
{
discoveryResult = addDiscoveryBaselineCommonProperties(discPayload);
VERIFY_SUCCESS(discoveryResult, OC_STACK_OK);
}
OCResourceProperty prop = OC_DISCOVERABLE;
}
OCResourceProperty prop = OC_DISCOVERABLE;
#ifdef MQ_BROKER
prop = (OC_MQ_BROKER_URI == virtualUriInRequest) ? OC_MQ_BROKER : prop;
prop = (OC_MQ_BROKER_URI == virtualUriInRequest) ? OC_MQ_BROKER : prop;
#endif
for (; resource && discoveryResult == OC_STACK_OK; resource = resource->next)
for (; resource && discoveryResult == OC_STACK_OK; resource = resource->next)
{
discoveryResult = findResourceAtRD(resource, interfaceQuery, resourceTypeQuery,
discPayload);
if (OC_STACK_NO_RESOURCE == discoveryResult)
{
discoveryResult = findResourceAtRD(resource, interfaceQuery, resourceTypeQuery,
discPayload);
if (OC_STACK_NO_RESOURCE == discoveryResult)
if ((!baselineQuery && (resource->resourceProperties & prop)) ||
(baselineQuery && (includeThisResourceInResponse(resource, interfaceQuery,
resourceTypeQuery))))
{
if ((!baselineQuery && (resource->resourceProperties & prop)) ||
(baselineQuery && (includeThisResourceInResponse(resource, interfaceQuery,
......@@ -848,10 +851,10 @@ static OCStackResult HandleVirtualResource (OCServerRequest *request, OCResource
}
}
}
if (discPayload->resources == NULL)
{
discoveryResult = OC_STACK_NO_RESOURCE;
}
}
if (discPayload->resources == NULL)
{
discoveryResult = OC_STACK_NO_RESOURCE;
}
}
else if (virtualUriInRequest == OC_DEVICE_URI)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment