[HOTFIX] Avoid adding status if there is no datamaps on table.

This closes #2222
diff --git a/core/src/main/java/org/apache/carbondata/core/datamap/status/DataMapStatusManager.java b/core/src/main/java/org/apache/carbondata/core/datamap/status/DataMapStatusManager.java
index 10ed80c..31ab4e4 100644
--- a/core/src/main/java/org/apache/carbondata/core/datamap/status/DataMapStatusManager.java
+++ b/core/src/main/java/org/apache/carbondata/core/datamap/status/DataMapStatusManager.java
@@ -53,11 +53,11 @@
 
   public static void disableDataMap(String dataMapName) throws Exception {
     DataMapSchema dataMapSchema = getDataMapSchema(dataMapName);
-    List<DataMapSchema> list = new ArrayList<>();
     if (dataMapSchema != null) {
+      List<DataMapSchema> list = new ArrayList<>();
       list.add(dataMapSchema);
+      storageProvider.updateDataMapStatus(list, DataMapStatus.DISABLED);
     }
-    storageProvider.updateDataMapStatus(list, DataMapStatus.DISABLED);
   }
 
   public static void disableDataMapsOfTable(CarbonTable table) throws IOException {
@@ -68,11 +68,11 @@
 
   public static void enableDataMap(String dataMapName) throws IOException, NoSuchDataMapException {
     DataMapSchema dataMapSchema = getDataMapSchema(dataMapName);
-    List<DataMapSchema> list = new ArrayList<>();
     if (dataMapSchema != null) {
+      List<DataMapSchema> list = new ArrayList<>();
       list.add(dataMapSchema);
+      storageProvider.updateDataMapStatus(list, DataMapStatus.ENABLED);
     }
-    storageProvider.updateDataMapStatus(list, DataMapStatus.ENABLED);
   }
 
   public static void enableDataMapsOfTable(CarbonTable table) throws IOException {
@@ -83,11 +83,11 @@
 
   public static void dropDataMap(String dataMapName) throws IOException, NoSuchDataMapException {
     DataMapSchema dataMapSchema = getDataMapSchema(dataMapName);
-    List<DataMapSchema> list = new ArrayList<>();
     if (dataMapSchema != null) {
+      List<DataMapSchema> list = new ArrayList<>();
       list.add(dataMapSchema);
+      storageProvider.updateDataMapStatus(list, DataMapStatus.DROPPED);
     }
-    storageProvider.updateDataMapStatus(list, DataMapStatus.DROPPED);
   }
 
   private static DataMapSchema getDataMapSchema(String dataMapName)
diff --git a/core/src/main/java/org/apache/carbondata/core/datamap/status/DiskBasedDataMapStatusProvider.java b/core/src/main/java/org/apache/carbondata/core/datamap/status/DiskBasedDataMapStatusProvider.java
index 001af2d..83e141d 100644
--- a/core/src/main/java/org/apache/carbondata/core/datamap/status/DiskBasedDataMapStatusProvider.java
+++ b/core/src/main/java/org/apache/carbondata/core/datamap/status/DiskBasedDataMapStatusProvider.java
@@ -98,6 +98,10 @@
   @Override
   public void updateDataMapStatus(List<DataMapSchema> dataMapSchemas, DataMapStatus dataMapStatus)
       throws IOException {
+    if (dataMapSchemas == null || dataMapSchemas.size() == 0) {
+      // There is nothing to update
+      return;
+    }
     ICarbonLock carbonTableStatusLock = getDataMapStatusLock();
     boolean locked = false;
     try {