From 6ca246e99dee84a0b425d35ded32b3c6894c926d Mon Sep 17 00:00:00 2001
From: Jagadedes <jagadees.pillai@zyxware.com>
Date: Wed, 19 Nov 2014 14:20:30 +0530
Subject: [PATCH] first time created widget warning fix

---
 CRM/Wci/Form/CreateWidget.php | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/CRM/Wci/Form/CreateWidget.php b/CRM/Wci/Form/CreateWidget.php
index e0b3579..1194d07 100644
--- a/CRM/Wci/Form/CreateWidget.php
+++ b/CRM/Wci/Form/CreateWidget.php
@@ -387,13 +387,13 @@ where w.id=" . $this->_id;*/
     );
     
     $result = civicrm_api3('group', 'get', array(
-      'group_type' => '2'
+      'group_type' => '2' // group type of newsletter(2)
     ));
-    
-    foreach ($result['values'] as $group) {
-      $options[$group['id']] = $group['title'];
-    }
-    
+    if (0 != $result['count']) {
+      foreach ($result['values'] as $group) {
+        $options[$group['id']] = $group['title'];
+      }
+    }    
     return $options;
   }
 
-- 
2.25.1