[IOT-2789]Fix for NS sample crash 99/22899/3
authorabitha.s <abitha.s@samsung.com>
Wed, 18 Oct 2017 09:02:47 +0000 (14:32 +0530)
committerUze Choi <uzchoi@samsung.com>
Thu, 19 Oct 2017 06:33:11 +0000 (06:33 +0000)
Change-Id: I4aa2f68b36b70946c0bcee0e9da04feef596ea85
Signed-off-by: abitha.s <abitha.s@samsung.com>
service/notification/cpp-wrapper/examples/linux/notificationserviceprovider.cpp

index 87d33d6..76b479c 100644 (file)
@@ -102,11 +102,11 @@ std::shared_ptr<OIC::Service::NSConsumer> printAvailableConsumers()
         std::cin.clear();
         std::cin.ignore(numeric_limits<streamsize>::max(), '\n');
     }
-    option--;
     if (option > discoveredConsumers.size())
     {
         return NULL;
     }
+    option--;
     std::string consumerId = discoveredConsumers[option];
     std::shared_ptr<OIC::Service::NSConsumer> consumer =
         NSProviderService::getInstance()->getConsumer(consumerId);