Fix: Avoid segfault if diagnostic bus isn't correctly set.
[apps/low-level-can-service.git] / src / low-can-binding.cpp
index 3e87072..45213d9 100644 (file)
@@ -255,13 +255,15 @@ extern "C"
 
                /// Initialize CAN socket
                if(can_bus_manager.init_can_dev() == 0)
+               {
                        can_bus_manager.start_threads();
 
-               /// Initialize Diagnostic manager that will handle obd2 requests.
-               /// We pass by default the first CAN bus device to its Initialization.
-               /// TODO: be able to choose the CAN bus device that will be use as Diagnostic bus.
-               if(configuration_t::instance().get_diagnostic_manager().initialize())
-                       return 0;
+                       /// Initialize Diagnostic manager that will handle obd2 requests.
+                       /// We pass by default the first CAN bus device to its Initialization.
+                       /// TODO: be able to choose the CAN bus device that will be use as Diagnostic bus.
+                       if(configuration_t::instance().get_diagnostic_manager().initialize())
+                               return 0;
+               }
 
                ERROR(binder_interface, "There was something wrong with CAN device Initialization. Check your config file maybe");
                return 1;