disk: guard against nil pointer dereferencing
Add guards protecting against dereferencing the pointer receiver of method calls. Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
This commit is contained in:
parent
beaf411628
commit
206e030f2c
6 changed files with 51 additions and 7 deletions
|
|
@ -66,6 +66,10 @@ func (lc *LUKSContainer) Clone() Entity {
|
|||
}
|
||||
|
||||
func (lc *LUKSContainer) GenUUID(rng *rand.Rand) {
|
||||
if lc == nil {
|
||||
return
|
||||
}
|
||||
|
||||
if lc.UUID == "" {
|
||||
lc.UUID = uuid.Must(newRandomUUIDFromReader(rng)).String()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue