mirror of
https://github.com/trufflesecurity/trufflehog.git
synced 2024-11-10 15:14:38 +00:00
[chore] Prevent panic when ChunkError has a nil Unit (#2227)
This commit is contained in:
parent
b0fab16ad4
commit
78b5a95342
1 changed files with 5 additions and 1 deletions
|
@ -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 }
|
||||
|
||||
|
|
Loading…
Reference in a new issue