-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
area:codegenSource generator workSource generator workcode-review-findingIssue identified from automated code reviewIssue identified from automated code reviewpriority:p1High priorityHigh prioritysource-generatorInvolves source generator workInvolves source generator worktype:bugBug fixBug fix
Description
Summary
BundleGenerator has null safety issues that can cause generator crashes.
Source: Code Review #705 (Issues 3, 6)
Issues
1. Force Unwrap on FirstOrDefault
Location: editor/KeenEyes.Generators/BundleGenerator.cs:300
// CURRENT - force unwrap can throw NRE:
typeSymbol.Locations.FirstOrDefault()!
// SHOULD BE:
var location = typeSymbol.Locations.FirstOrDefault();
if (location == null) return; // or use default location2. Dangerous String Substring
Location: editor/KeenEyes.Generators/BundleGenerator.cs:1188
// CURRENT - assumes namespace exists:
var bundleName = typeToRemove.Substring(typeToRemove.LastIndexOf('.') + 1);
// SHOULD BE:
var lastDot = typeToRemove.LastIndexOf('.');
var bundleName = lastDot >= 0 ? typeToRemove.Substring(lastDot + 1) : typeToRemove;Impact
Generator crashes for edge cases (global namespace types, types without source location).
Priority
HIGH - Generator stability.
Metadata
Metadata
Assignees
Labels
area:codegenSource generator workSource generator workcode-review-findingIssue identified from automated code reviewIssue identified from automated code reviewpriority:p1High priorityHigh prioritysource-generatorInvolves source generator workInvolves source generator worktype:bugBug fixBug fix