Skip to content

fix uninitialized arguments#93

Merged
ShiCheng-Lu merged 1 commit into
masterfrom
shicheng/uninitialized-var
Jan 22, 2026
Merged

fix uninitialized arguments#93
ShiCheng-Lu merged 1 commit into
masterfrom
shicheng/uninitialized-var

Conversation

@ShiCheng-Lu

@ShiCheng-Lu ShiCheng-Lu commented Jan 21, 2026

Copy link
Copy Markdown
Contributor

We had a uninitialized variable (trackingOptions) at startTrip, which caused the dict pointer to be valid as it's uninitialized pointer, and trying to read properties of this "dict" causes some problems.

so also taking this chance to fix all other uninitialized variables. (and clean up some of the variable assignments so it's clear the variables will be valid)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes uninitialized variable issues in the iOS Flutter plugin by initializing local variables at declaration time instead of relying on conditional initialization. The changes improve code safety by ensuring all variables have defined values before use.

Changes:

  • Replaced conditional initialization patterns with inline initialization using default values
  • Changed pointer variables (CLLocation, RadarTrackingOptions) to initialize with nil
  • Changed primitive int variables to initialize with their default values (1000 for radius, 10 for limit)
  • Changed enum variables (RadarRouteUnits) to initialize with default enum values (RadarRouteUnitsImperial)

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

Comment thread ios/Classes/RadarFlutterPlugin.m
@cameron-radar

Copy link
Copy Markdown
Contributor

I don't know enough about objc to review this properly 😅 . In c# variables are automatically "initialized" to their default values so unless it's different in objc all these changes would seem redundant to me

@ShiCheng-Lu ShiCheng-Lu merged commit 77bfd69 into master Jan 22, 2026
7 checks passed
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.

4 participants