oem_ibm: Fix pldm crash

Check for the presence of the directory before iterating
through it. Iterating over a missing directory would crash
pldm.

Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>
Change-Id: I3296a427cb5e904dbc1fd48a109eedc051cf832d
diff --git a/oem/ibm/libpldmresponder/inband_code_update.cpp b/oem/ibm/libpldmresponder/inband_code_update.cpp
index 980a869..9a02c13 100644
--- a/oem/ibm/libpldmresponder/inband_code_update.cpp
+++ b/oem/ibm/libpldmresponder/inband_code_update.cpp
@@ -337,11 +337,16 @@
 
 void CodeUpdate::clearDirPath(const std::string& dirPath)
 {
-    for (auto& path : fs::directory_iterator(dirPath.c_str()))
+    if (!fs::is_directory(dirPath))
     {
-        fs::remove_all(path);
+        std::cerr << "The directory does not exist, dirPath = " << dirPath
+                  << std::endl;
+        return;
     }
-    return;
+    for (const auto& iter : fs::directory_iterator(dirPath))
+    {
+        fs::remove_all(iter);
+    }
 }
 
 void CodeUpdate::sendStateSensorEvent(