sdm: Add color mode name checking in SetColorMode

Change fix the issue of device crash when pass
an empty string of color mode name.

Change-Id: I849a2773713d18b57a461f10ae678769a06fde14
diff --git a/sdm/libs/core/display_base.cpp b/sdm/libs/core/display_base.cpp
index e2c2dab..ba8700a 100644
--- a/sdm/libs/core/display_base.cpp
+++ b/sdm/libs/core/display_base.cpp
@@ -980,6 +980,10 @@
     return kErrorNotSupported;
   }
 
+  if (color_mode.empty()) {
+    return kErrorParameters;
+  }
+
   DisplayError error = kErrorNone;
   std::string dynamic_range = kSdr, str_render_intent;
   if (IsSupportColorModeAttribute(color_mode)) {
@@ -1963,6 +1967,11 @@
 PrimariesTransfer DisplayBase::GetBlendSpaceFromColorMode() {
   PrimariesTransfer pt = {};
   auto current_color_attr_ = color_mode_attr_map_.find(current_color_mode_);
+  if (current_color_attr_ == color_mode_attr_map_.end()) {
+    DLOGE("The attritbutes is not present in color mode: %s", current_color_mode_.c_str());
+    return pt;
+  }
+
   AttrVal attr = current_color_attr_->second;
   std::string color_gamut = kNative, dynamic_range = kSdr, pic_quality = kStandard;
   std::string transfer = {};