mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-23 10:05:19 +00:00
Fix crash when a prefix family was empty
This commit is contained in:
parent
40953727cf
commit
dd0cc74688
@ -377,14 +377,18 @@ func NewHeadscaleDatabase(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = tx.Model(&types.Node{}).Where("id = ?", node.ID).Update("ipv4", v4.String()).Error
|
if v4 != nil {
|
||||||
if err != nil {
|
err = tx.Model(&types.Node{}).Where("id = ?", node.ID).Update("ipv4", v4.String()).Error
|
||||||
return fmt.Errorf("saving ip addresses to new columns: %w", err)
|
if err != nil {
|
||||||
|
return fmt.Errorf("saving ip addresses to new columns: %w", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = tx.Model(&types.Node{}).Where("id = ?", node.ID).Update("ipv6", v6.String()).Error
|
if v6 != nil {
|
||||||
if err != nil {
|
err = tx.Model(&types.Node{}).Where("id = ?", node.ID).Update("ipv6", v6.String()).Error
|
||||||
return fmt.Errorf("saving ip addresses to new columns: %w", err)
|
if err != nil {
|
||||||
|
return fmt.Errorf("saving ip addresses to new columns: %w", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user