From: jihun.ha Date: Wed, 24 Dec 2014 04:46:37 +0000 (+0900) Subject: Fix an exception handling issue in doBootStrap() function of X-Git-Tag: 1.2.0+RC1~2018^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f3344c1e09c42722c023a1ae3940496e2025a97d;p=platform%2Fupstream%2Fiotivity.git Fix an exception handling issue in doBootStrap() function of ThingsConfiguration class. In the case that a callback pointer of the function is NULL, a return value for the function call will be OC_STACK_ERROR rather than OC_STACK_OK. Reference issue ID : [IOT-196] Change-Id: Ieb280bc6e5317496b96342a0374129c1e692b415 Signed-off-by: jihun.ha --- diff --git a/service/things-manager/sampleapp/linux/configuration/con-server.cpp b/service/things-manager/sampleapp/linux/configuration/con-server.cpp old mode 100644 new mode 100755 index 6b26437..c83c7a0 --- a/service/things-manager/sampleapp/linux/configuration/con-server.cpp +++ b/service/things-manager/sampleapp/linux/configuration/con-server.cpp @@ -325,8 +325,10 @@ int main() break; else if (g_Steps == 1) { - g_thingsmanager->doBootstrap(&onBootstrap); - isWaiting = 1; + if( g_thingsmanager->doBootstrap(&onBootstrap) == OC_STACK_OK) + isWaiting = 1; + else + std::cout << "A callback pointer of the function is NULL." << std::endl; } else if (g_Steps == 2) { diff --git a/service/things-manager/sdk/src/ThingsConfiguration.cpp b/service/things-manager/sdk/src/ThingsConfiguration.cpp old mode 100644 new mode 100755 index a0f57a2..5a4777f --- a/service/things-manager/sdk/src/ThingsConfiguration.cpp +++ b/service/things-manager/sdk/src/ThingsConfiguration.cpp @@ -597,7 +597,10 @@ namespace OIC OCStackResult ThingsConfiguration::doBootstrap(ConfigurationCallback callback) { - g_bootstrapCallback = callback; + if(callback == NULL) + return OC_STACK_ERROR; + else + g_bootstrapCallback = callback; // Find bootstrap server. std::vector < std::string > type;