Fix for following issue about Notification Manager SampleProvider.
authorjyong2.kim <jyong2.kim@samsung.com>
Tue, 28 Apr 2015 12:19:44 +0000 (21:19 +0900)
committerUze Choi <uzchoi@samsung.com>
Wed, 29 Apr 2015 00:59:51 +0000 (00:59 +0000)
[IOT-459] Notification Manager Sample consumer and provider app doesnot handle invalid menu option properly

Change-Id: Ibabe15fe2c6192817b4216a0050cb8711767700e
Signed-off-by: jyong2.kim <jyong2.kim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/855
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Tested-by: Uze Choi <uzchoi@samsung.com>
service/notification-manager/SampleApp/linux/sampleProvider/SampleProvider.cpp

index 2e9a23f..3c50d0b 100755 (executable)
@@ -395,6 +395,13 @@ int main()
             cout << "========================================================" << endl;
 
             cin >> number;
+            if(std::cin.fail())
+            {
+                std::cin.clear();
+                std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
+                std::cout << "Invalid input type, please try again" << std::endl;
+                continue;
+            }
 
             switch (number)
             {