Skip to content

Find, verify, and analyze leaked credentials

[chore] Prevent panic when ChunkError has a nil Unit (#2227)

Miccah78b5a9534201
diff --git a/pkg/sources/job_progress.go b/pkg/sources/job_progress.go
index eb7aae3fe..d7bbc5b83 100644
--- a/pkg/sources/job_progress.go
+++ b/pkg/sources/job_progress.go
@@ -94,7 +94,11 @@ type ChunkError struct {
}
func (f ChunkError) Error() string {
- return fmt.Sprintf("error chunking unit %q: %s", f.Unit.SourceUnitID(), f.Err.Error())
+ unit := "<nil>"
+ if f.Unit != nil {
+ unit = f.Unit.SourceUnitID()
+ }
+ return fmt.Sprintf("error chunking unit %q: %s", unit, f.Err.Error())
}
func (f ChunkError) Unwrap() error { return f.Err }