Fix isPackageInstalled method when salt return is empty

PROD-32178

Change-Id: Icbd998f6efcd08b743bb1bb849f86c5f09f85e03
diff --git a/src/com/mirantis/mk/Salt.groovy b/src/com/mirantis/mk/Salt.groovy
index daff9fc..7347205 100644
--- a/src/com/mirantis/mk/Salt.groovy
+++ b/src/com/mirantis/mk/Salt.groovy
@@ -1348,11 +1348,15 @@
 def isPackageInstalled(Map params) {
     def output = params.get('output', true)
     def res = runSaltProcessStep(params.saltId, params.target, "pkg.info_installed", params.packageName, null, output)['return'][0]
-    for (int i = 0; i < res.size(); i++) {
-        def key = res.keySet()[i]
-        if (!(res[key] instanceof Map && res[key].containsKey(params.packageName))) {
-            return false
+    if (res) {
+        for (int i = 0; i < res.size(); i++) {
+            def key = res.keySet()[i]
+            if (!(res[key] instanceof Map && res[key].containsKey(params.packageName))) {
+                return false
+            }
         }
+        return true
+    } else {
+        return false
     }
-    return true
 }