Fix coredump when using nullptr

If udpSocket is not initialized when executing the setupSignal method
acoredump may occur due to the use of a nullptr.

Change-Id: Id32990ab8ed3dc75767cc1c2e5660157223f473d
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
diff --git a/sd_event_loop.cpp b/sd_event_loop.cpp
index 88fdf2e..537033d 100644
--- a/sd_event_loop.cpp
+++ b/sd_event_loop.cpp
@@ -251,8 +251,11 @@
     boost::asio::signal_set signals(*io, SIGINT, SIGTERM);
     signals.async_wait([this](const boost::system::error_code& /* error */,
                               int /* signalNumber */) {
-        udpSocket->cancel();
-        udpSocket->close();
+        if (udpSocket)
+        {
+            udpSocket->cancel();
+            udpSocket->close();
+        }
         io->stop();
     });
 }