bugfix: FruDevice handle empty string as name

In the case where the Fru property is found but is empty, it will now
correctly treat this as invalid.

Tested: Verified on real board that now there are two Fru Devices with
the same name, the second ending with "_0" whereas before it was two
devices, one with an empty string and the second with "_0" as the entire
name.

Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I06cca20f4bc59fa5291d44086c58ba1b85e36f78
diff --git a/src/FruDevice.cpp b/src/FruDevice.cpp
index baa90d4..0f1350c 100644
--- a/src/FruDevice.cpp
+++ b/src/FruDevice.cpp
@@ -546,13 +546,18 @@
                   << bus << " address " << address << "\n";
         return;
     }
+
     auto productNameFind = formattedFru.find("BOARD_PRODUCT_NAME");
     std::string productName;
-    if (productNameFind == formattedFru.end())
+    // Not found under Board section or an empty string.
+    if (productNameFind == formattedFru.end() ||
+        productNameFind->second.empty())
     {
         productNameFind = formattedFru.find("PRODUCT_PRODUCT_NAME");
     }
-    if (productNameFind != formattedFru.end())
+    // Found under Product section and not an empty string.
+    if (productNameFind != formattedFru.end() &&
+        !productNameFind->second.empty())
     {
         productName = productNameFind->second;
         std::regex illegalObject("[^A-Za-z0-9_]");