Check for errors before trying to open a bus

This is a fix to a regression introduced as part of
9b86787adea3f8f29fac2acbb9fa0f48fbcf244a
namely, the recursive iterator doesn't check for the existence of a bus
path before attempting to open it, which results in a crash when
std::filesystem throws an exception.

This was reported as part of bug #8

Tested:
Launched entity-manager in qemu, which was previously crashing and
observed "Unable to open path /sys/bus/i2c/devices/i2c-4" in the journal
log, with entity-manager staying running.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I638a66e271df0041d4df75be22eb03c064d9cf68
diff --git a/src/Overlay.cpp b/src/Overlay.cpp
index 1ced2d8..d18cf9d 100644
--- a/src/Overlay.cpp
+++ b/src/Overlay.cpp
@@ -169,8 +169,14 @@
     std::string addressHex = hex.str();
     std::string busStr = std::to_string(*bus);
 
-    for (auto path = std::filesystem::recursive_directory_iterator(devicePath);
-         path != std::filesystem::recursive_directory_iterator(); path++)
+    std::error_code ec;
+    auto path = std::filesystem::recursive_directory_iterator(devicePath, ec);
+    if (ec)
+    {
+        std::cerr << "Unable to open path " << devicePath << "\n";
+        return false;
+    }
+    for (; path != std::filesystem::recursive_directory_iterator(); path++)
     {
         if (!std::filesystem::is_directory(*path))
         {