eganwu 2 лет назад
Родитель
Сommit
2ed8d05065

+ 15 - 3
src/custom/restcontroller/webmanage/saletool/sharematerial/LongPicText.java

@@ -208,7 +208,11 @@ public class LongPicText extends Controller {
         JSONArray jsonArray = new JSONArray();
         if (rows.isNotEmpty()) {
             jsonObject = rows.get(0).getJSONObject("sharepagecontrol");
-            jsonArray = jsonObject.getJSONArray("pics");
+            if (jsonObject.containsKey("pics")) {
+                jsonArray = jsonObject.getJSONArray("pics");
+            } else {
+                jsonArray = new JSONArray();
+            }
         }
 
         ArrayList<Long> ids = new ArrayList<>();
@@ -239,7 +243,11 @@ public class LongPicText extends Controller {
         JSONArray jsonArray = new JSONArray();
         if (rows.isNotEmpty()) {
             jsonObject = rows.get(0).getJSONObject("sharepagecontrol");
-            jsonArray = jsonObject.getJSONArray("pics");
+            if (jsonObject.containsKey("pics")) {
+                jsonArray = jsonObject.getJSONArray("pics");
+            } else {
+                jsonArray = new JSONArray();
+            }
         }
         JSONArray newjsonArray = getTempJSONArray(jsonArray, String.valueOf(attachmentid));
 
@@ -276,7 +284,11 @@ public class LongPicText extends Controller {
         JSONArray jsonArray = new JSONArray();
         if (rows.isNotEmpty()) {
             jsonObject = rows.get(0).getJSONObject("sharepagecontrol");
-            jsonArray = jsonObject.getJSONArray("pics");
+            if (jsonObject.containsKey("pics")) {
+                jsonArray = jsonObject.getJSONArray("pics");
+            } else {
+                jsonArray = new JSONArray();
+            }
         }
         jsonObject.put("pics", getTempJSONArray(jsonArray, String.valueOf(attachmentid)));