Skip to content

fix: move argument validation before sys.argv access in mkconcore.py (fixes #267)#336

Open
GaneshPatil7517 wants to merge 2 commits intoControlCore-Project:devfrom
GaneshPatil7517:fix/mkconcore-arg-validation-v2
Open

fix: move argument validation before sys.argv access in mkconcore.py (fixes #267)#336
GaneshPatil7517 wants to merge 2 commits intoControlCore-Project:devfrom
GaneshPatil7517:fix/mkconcore-arg-validation-v2

Conversation

@GaneshPatil7517
Copy link

@GaneshPatil7517 GaneshPatil7517 commented Feb 15, 2026

@pradeeban sir

Summary

Fixes #267mkconcore.py crashes with IndexError when run without arguments because sys.argv[1], sys.argv[2], and sys.argv[3] are accessed before the argument count is validated.

Changes

  • Moved the existing len(sys.argv) < 4 check from line ~207 to line ~140, before any sys.argv access
  • Changed elif to if at the original location since the early-exit block was removed above it

No new logic, no style changes, no whitespace modifications. The same validation code is simply relocated earlier.

Diff

  • 1 file changed
  • 6 insertions, 5 deletions

Before / After

Before: python mkconcore.pyIndexError: list index out of range
After: python mkconcore.py → prints usage message and exits cleanly

Copilot AI review requested due to automatic review settings February 15, 2026 05:07
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes mkconcore.py crashing with IndexError when invoked without enough CLI arguments by moving the len(sys.argv) validation ahead of any sys.argv[...] access.

Changes:

  • Move the existing len(sys.argv) < 4 early-exit usage check to before sys.argv[1], sys.argv[2], and sys.argv[3] are accessed.
  • Adjust the later branching from elif to if since the earlier check now handles the missing-args case.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

1 participant