Skip to content

fix(bi): guard empty data array in EditorChartSql before destructuring#2164

Open
Aias00 wants to merge 1 commit into
OtterMind:mainfrom
Aias00:fix/2162-editorchartsql-crash
Open

fix(bi): guard empty data array in EditorChartSql before destructuring#2164
Aias00 wants to merge 1 commit into
OtterMind:mainfrom
Aias00:fix/2162-editorchartsql-crash

Conversation

@Aias00

@Aias00 Aias00 commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Related issue

Closes #2162

Summary

EditorChartSql.onExecuteSQLCallback destructured data[0] without guarding the empty case. Running a non-result SQL statement (DDL/INSERT/UPDATE) in the BI chart SQL editor yields data = [], so data[0] is undefined and the destructure throws. Added if (!data.length) return; before the destructure.

Verification

  • tsc + eslint clean for EditorChartSql/index.tsx.

Contributor declaration

  • I linked the Issue that defines this change.
  • I tested the affected behavior and reported the actual results above.
  • I did not include credentials, private data, or generated build output.
  • I disclosed substantial AI assistance below, or this PR contains no substantial AI-generated code.

AI assistance: The fix, verification, and PR description were produced with Claude Code assistance.

onExecuteSQLCallback destructured data[0] without checking data.length,
crashing when a non-result SQL (DDL/INSERT/UPDATE) was run in the BI
chart editor. Guard before destructuring.

Fixes OtterMind#2162

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 26, 2026 07:13
@Aias00
Aias00 requested a review from openai0229 as a code owner July 26, 2026 07:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

EditorChartSql onExecuteSQLCallback crashes on empty data array (non-result SQL)

3 participants