APPLINK-6473:Fixed AddCommand request return response INVALID_DATA when parameter...
authorDmitriy Trunov <DTrunov@luxoft.com>
Thu, 27 Mar 2014 12:17:01 +0000 (14:17 +0200)
committerJustin Dickow <jjdickow@gmail.com>
Tue, 8 Jul 2014 22:15:54 +0000 (18:15 -0400)
src/components/HMI/app/model/sdl/AppModel.js
src/components/application_manager/src/commands/mobile/add_command_request.cc

index 2935324..6f8c300 100644 (file)
@@ -253,7 +253,7 @@ SDL.SDLAppModel = Em.Object.extend({
          */
         addCommand: function (request) {
 
-            var parentID = request.params.menuParams.parentID >= 0 ? request.params.menuParams.parentID : 'top';
+            var parentID = request.params.menuParams.parentID > 0 ? request.params.menuParams.parentID : 'top';
 
             if (!this.get('commandsList.' + parentID)) {
                 this.commandsList[parentID] = [];
index 99013da..999d0d4 100644 (file)
@@ -98,8 +98,9 @@ void AddCommandRequest::Run() {
       SendResponse(false, mobile_apis::Result::DUPLICATE_NAME);
       return;
     }
-    if ((*message_)[strings::msg_params][strings::menu_params].keyExists(
-        hmi_request::parent_id)) {
+    if (((*message_)[strings::msg_params][strings::menu_params].keyExists(
+        hmi_request::parent_id)) && (0 != (*message_)[strings::msg_params]
+       [strings::menu_params][hmi_request::parent_id].asUInt())) {
       if (!CheckCommandParentId(app)) {
         SendResponse(false, mobile_apis::Result::INVALID_ID,
                      "Parent ID doesn't exist");