Skip to content

Commit

Permalink
hotfix : SSE 접속시 code name parsing 로직 수정 (#125)
Browse files Browse the repository at this point in the history
* hotfix : SSE 접속시 code name parsing 로직 수정

* fix : mafiaTarget null일시 npe 방지 로직 추가
  • Loading branch information
waterricecake committed Oct 14, 2024
1 parent 3b18d17 commit c57c5a3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/main/java/mafia/mafiatogether/game/aspect/SseService.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import mafia.mafiatogether.common.annotation.PlayerInfo;
import mafia.mafiatogether.common.exception.AuthException;
import mafia.mafiatogether.common.exception.ExceptionCode;
import mafia.mafiatogether.common.resolver.PlayerInfoDto;
import mafia.mafiatogether.game.application.dto.response.GameStatusResponse;
import mafia.mafiatogether.game.domain.Game;
import mafia.mafiatogether.game.domain.GameRepository;
Expand Down Expand Up @@ -45,8 +46,9 @@ public ResponseEntity<SseEmitter> subscribe(final ProceedingJoinPoint joinPoint)
String[] codeAndName = new String[2];
for (int i = 0; i < parameterAnnotations.length; i++) {
if (hasPlayerInfo(parameterAnnotations[i])) {
codeAndName[0] = args[i].toString();
codeAndName[1] = args[i].toString();
PlayerInfoDto playerInfoDto = (PlayerInfoDto) args[i];
codeAndName[0] = playerInfoDto.code();
codeAndName[1] = playerInfoDto.name();
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public JobTarget() {
public String findTarget() {
final String mafiaTarget = findJobTargetBy(JobType.MAFIA);
final String doctorTarget = findJobTargetBy(JobType.DOCTOR);
if (mafiaTarget.equals(doctorTarget)) {
if (mafiaTarget == null || mafiaTarget.equals(doctorTarget)) {
return null;
}
return mafiaTarget;
Expand Down

0 comments on commit c57c5a3

Please sign in to comment.