binchoo / PaimonGanyu

여행 비서 페이몬! Genshin Impact AWS workflows & KakaoTalk chatbot skills
https://pf.kakao.com/_mtPFb
GNU General Public License v3.0
7 stars 1 forks source link

[DailyCheck][Application] When DailyCheckListView's first item is for failure, NullPointerException occurs. #27

Closed binchoo closed 1 year ago

binchoo commented 1 year ago

As-is:

Sep 20 16:07:22 ip-172-31-1-97 web: java.lang.NullPointerException: null
Sep 20 16:07:22 ip-172-31-1-97 web: at org.binchoo.paimonganyu.chatbot.views.dailycheck.DailyCheckListView.renderBlockButton(DailyCheckListView.java:144) ~[classes!/:na]

To-be:

  1. Fix the constructor signature to get a Blocks singleton from external.
    https://github.com/binchoo/PaimonGanyu/blob/93c93c21a8bf2fd5a7cd48d7252265fee5e8057f/PaimonGanyu/paimonganyu-app/paimonganyu-skill/src/main/java/org/binchoo/paimonganyu/chatbot/views/dailycheck/DailyCheckListView.java#L39-L41
 public DailyCheckListView(Images images, QuickReplies quickReplies, Blocks blocks) { 
     super(images, quickReplies, blocks); 
 } 
  1. Set extra information before calling the DailyCheckIn block.
    private List<Button> renderBlockButton(int index) { 
     return List.of(BlockButton.builder() 
             .blockId(blocks().findByFallbackMethod(FallbackMethods.DailyCheckIn))
             .extra(Map.of("index", index)) 
             .label("호요랩 출석 요청") 
             .build()); 
    } 
binchoo commented 1 year ago

This bug was recognized several times in the past and is finally resolved today. image