]> git.sesse.net Git - casparcg/commitdiff
Removed unnecessary exception throwing for absent template-hosts element in config...
authorHelge Norberg <helge.norberg@gmail.com>
Wed, 29 May 2013 07:51:04 +0000 (09:51 +0200)
committerHelge Norberg <helge.norberg@gmail.com>
Wed, 29 May 2013 07:51:04 +0000 (09:51 +0200)
modules/flash/producer/flash_producer.cpp

index 43a0272d3f35235de863b766563b0141332faffb..db5022b4931dff51122f36d9583b3271bba5774b 100644 (file)
@@ -105,19 +105,23 @@ template_host get_template_host(const core::video_format_desc& desc)
        try\r
        {\r
                std::vector<template_host> template_hosts;\r
-               BOOST_FOREACH(auto& xml_mapping, env::properties().get_child(L"configuration.template-hosts"))\r
-               {\r
-                       try\r
+               auto template_hosts_element = env::properties().get_child_optional(\r
+                               L"configuration.template-hosts");\r
+\r
+               if (template_hosts_element)\r
+                       BOOST_FOREACH(auto& xml_mapping, *template_hosts_element)\r
                        {\r
-                               template_host template_host;\r
-                               template_host.video_mode                = xml_mapping.second.get(L"video-mode", L"");\r
-                               template_host.filename                  = xml_mapping.second.get(L"filename",   L"cg.fth");\r
-                               template_host.width                             = xml_mapping.second.get(L"width",              desc.width);\r
-                               template_host.height                    = xml_mapping.second.get(L"height",             desc.height);\r
-                               template_hosts.push_back(template_host);\r
+                               try\r
+                               {\r
+                                       template_host template_host;\r
+                                       template_host.video_mode                = xml_mapping.second.get(L"video-mode", L"");\r
+                                       template_host.filename                  = xml_mapping.second.get(L"filename",   L"cg.fth");\r
+                                       template_host.width                             = xml_mapping.second.get(L"width",              desc.width);\r
+                                       template_host.height                    = xml_mapping.second.get(L"height",             desc.height);\r
+                                       template_hosts.push_back(template_host);\r
+                               }\r
+                               catch(...){}\r
                        }\r
-                       catch(...){}\r
-               }\r
 \r
                auto template_host_it = boost::find_if(template_hosts, [&](template_host template_host){return template_host.video_mode == desc.name;});\r
                if(template_host_it == template_hosts.end())\r