fangqing 3 ヶ月 前
コミット
a70e4d8cf4

+ 4 - 1
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityCollectionServiceImpl.java

@@ -223,7 +223,10 @@ public class CommunityCollectionServiceImpl extends ServiceImpl<CommunityCollect
                     .select("image_url")
                     .eq("article_id", communityArticle.getId()));
             if (!articleImages.isEmpty()) {
-                collectionArticleVo.setImageUrl(articleImages.get(0).getImageUrl());
+                if ( articleImages.get(0) != null ) {
+                    String imageUrl = articleImages.get(0).getImageUrl();
+                    collectionArticleVo.setImageUrl(imageUrl);
+                }
             }
 
             collectionArticleVos.add(collectionArticleVo);