Skip to content

[Fix] MenuType enum의 llegalArgumentException을 예방합니다#486

Merged
PeraSite merged 4 commits intodevelopfrom
fix/issue-enum-menu-type
Mar 3, 2026
Merged

[Fix] MenuType enum의 llegalArgumentException을 예방합니다#486
PeraSite merged 4 commits intodevelopfrom
fix/issue-enum-menu-type

Conversation

@HI-JIN2
Copy link
Member

@HI-JIN2 HI-JIN2 commented Mar 3, 2026

Summary

재현 경로 못 찾겠음

MenuType이 이전 화면에서 intent로 넘어오는데 정체모를원인으로 no enum으로 넘어오는듯함
매번 그런게 아니라 어쩌다 한번으로 추정됨

as-is to-be
MenuType이 전달안되었을시 앱이 터짐 앱이 터지지 않고 에러뷰 처리

Describe your changes

  • lateinit 대신 기본값을 null로 해서 비정상 종료를 방지함
  • 파이어베이스 로깅 추가
  • 에러뷰 추가
스크린샷 2026-03-03 오전 11 28 02

Issue

To reviewers

에러뷰 처리가 적절한지 확인해주세요!

@HI-JIN2 HI-JIN2 self-assigned this Mar 3, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 ReviewComposeActivity에서 MenuType enum 값을 intent로 전달받을 때 발생할 수 있는 IllegalArgumentException으로 인한 앱 충돌 문제를 해결합니다. menuType 변수를 널 허용으로 변경하고, MenuType.valueOf() 호출 시 안전한 파싱 로직을 적용하여 유효하지 않거나 널인 값이 들어올 경우 앱이 비정상 종료되는 대신 활동을 종료하도록 처리함으로써 안정성을 향상시켰습니다.

Highlights

  • 널 안전성 개선: lateinit 변수 menuType을 널 허용 var로 변경하여 초기화되지 않은 상태로 인한 잠재적 충돌을 방지했습니다.
  • 안전한 Enum 파싱: intent에서 MenuType 값을 안전하게 파싱하기 위해 runCatching 블록을 도입하여 IllegalArgumentException 발생 시 앱 충돌을 방지했습니다.
  • 오류 처리 로직 추가: 유효하지 않거나 널인 MenuType 값이 수신될 경우, 활동을 종료하고 오류를 기록하도록 오류 처리 로직을 추가했습니다.
  • 불필요한 .toString() 제거: intent.getStringExtra("menuType") 호출에서 불필요한 .toString()을 제거하여 널 값을 "null" 문자열로 변환하는 것을 방지하고, MenuType.valueOf("null")로 인한 예외를 막았습니다.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • app/src/main/java/com/eatssu/android/presentation/cafeteria/review/ReviewComposeActivity.kt
    • menuType 변수를 lateinit var에서 var menuType: String? = null로 변경했습니다.
    • MenuType.valueOf() 호출을 runCatching 블록으로 감싸서 파싱 오류를 처리하고, 유효하지 않은 경우 활동을 종료하도록 로직을 추가했습니다.
    • intent.getStringExtra("menuType")에서 .toString() 호출을 제거하여 널 값을 올바르게 처리하도록 수정했습니다.
Activity
  • 작성자는 MenuTypeintent로 전달될 때 "no enum"으로 넘어오는 원인을 찾지 못했으며, 이 문제가 간헐적으로 발생한다고 추정했습니다.
  • 작성자는 lateinit 대신 기본값을 null로 설정하여 비정상 종료를 방지하고 에러 뷰를 추가했다고 설명했습니다.
  • 작성자는 리뷰어에게 에러 뷰 처리가 적절한지 확인해달라고 요청했습니다.
  • 이 PR은 MenuType.valueOf 비정상 종료 이벤트 #434 이슈를 해결하며, Firebase Crashlytics 보고서 링크가 제공되었습니다.
  • 작성자는 변경 사항을 보여주는 스크린샷을 첨부했습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@HI-JIN2 HI-JIN2 requested a review from PeraSite March 3, 2026 02:30
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

안녕하세요. IllegalArgumentException 발생으로 인한 비정상 종료를 방지하기 위한 수고에 감사드립니다. lateinit 대신 nullable 타입과 runCatching을 사용하여 안전하게 MenuType을 파싱하도록 변경한 점이 좋습니다.

리뷰에서 몇 가지 중요한 점을 발견했습니다. 가장 치명적인 문제는 getIntents()setContent 이후에 호출되어, menuType 등의 속성이 초기화되기 전에 사용된다는 점입니다. 이로 인해 액티비티가 항상 즉시 종료될 것입니다. 또한, 오류 발생 시 사용자 경험을 개선할 수 있는 방안에 대한 제안도 포함했습니다.

자세한 내용은 각 코드 라인에 남긴 코멘트를 확인해주세요.

@HI-JIN2 HI-JIN2 marked this pull request as draft March 3, 2026 02:37
@HI-JIN2 HI-JIN2 marked this pull request as ready for review March 3, 2026 02:53
@HI-JIN2 HI-JIN2 changed the title [Fix] MenuType enum -llegalArgumentException [Fix] MenuType enum의 llegalArgumentException을 예방합니다 Mar 3, 2026
Comment on lines 44 to 65
@@ -60,7 +66,6 @@ class ReviewComposeActivity : ComponentActivity() {
Copy link
Member

@PeraSite PeraSite Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

val menuTypeEnum = MenuType.entries.find { it.name == menuType }

menuTypeEnum?.let {
    ReviewNav(
        navHostController = navHostController,
        menuType = MenuType.valueOf(menuType),
        menuName = itemName,
        id = itemId,
        onExit = { finish() }
    )
} ?: ErrorScreen(
    onBackClick = { finish() }
)

이렇게 깔끔하게 수정하는건 어떨까욧? 굳이 에러 로깅을 할 필요는 없이 프론트엔드에서 느슨하게 처리해도 좋다고 생각합니당

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

제가 수정 푸시하고 출시할게요~!

Copy link
Member

@PeraSite PeraSite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@PeraSite PeraSite merged commit 1ffec50 into develop Mar 3, 2026
2 checks passed
@PeraSite PeraSite deleted the fix/issue-enum-menu-type branch March 3, 2026 05:52
@PeraSite PeraSite mentioned this pull request Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MenuType.valueOf 비정상 종료 이벤트

2 participants