diff Platforms/Wasm/WasmPlatformApplicationAdapter.cpp @ 319:daa04d15192c am-2

new SimpleViewer sample that has been split in multiple files to be able to scale it
author am@osimis.io
date Thu, 11 Oct 2018 13:16:54 +0200
parents be2660b6e40a
children a902a07769d4
line wrap: on
line diff
--- a/Platforms/Wasm/WasmPlatformApplicationAdapter.cpp	Mon Oct 08 17:10:08 2018 +0200
+++ b/Platforms/Wasm/WasmPlatformApplicationAdapter.cpp	Thu Oct 11 13:16:54 2018 +0200
@@ -19,10 +19,14 @@
       try
       {
         Json::Value inputJson;
+        // if the message is a command, build it and execute it
         if (MessagingToolbox::ParseJson(inputJson, input.c_str(), input.size()))
         {
             std::unique_ptr<ICommand> command(application_.GetCommandBuilder().CreateFromJson(inputJson));
-            application_.ExecuteCommand(*command);
+            if (command.get() == NULL) 
+              printf("Could not parse command: '%s'\n", input.c_str());
+            else
+              application_.ExecuteCommand(*command);
         }
       }
       catch (StoneException& exc)