Skip to content

fix(chat): prevent crash in findDefaultModel by handling undefined metadata and empty model list#309203

Open
Akash504-ai wants to merge 1 commit intomicrosoft:mainfrom
Akash504-ai:fix/model-default-safety
Open

fix(chat): prevent crash in findDefaultModel by handling undefined metadata and empty model list#309203
Akash504-ai wants to merge 1 commit intomicrosoft:mainfrom
Akash504-ai:fix/model-default-safety

Conversation

@Akash504-ai
Copy link
Copy Markdown

Fix potential undefined access in findDefaultModel

Summary

  • Add optional chaining to safely access isDefaultForLocation
  • Handle empty models array

Why

Prevents possible runtime errors when metadata is missing or no models are available.

Testing

  • Verified no crash when models is empty
  • Verified safe behavior with missing metadata

Fixes #309202

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Potential undefined access in findDefaultModel (missing optional chaining)

2 participants