Update snapshot.go

avoid a panic on a too short slice.
This commit is contained in:
Adrien Delorme 2019-11-05 15:48:32 +01:00
parent 7108f6d07e
commit 116a038de9
1 changed files with 1 additions and 1 deletions

View File

@ -35,7 +35,7 @@ func ParseSnapshotData(snapshotData string) (*VBoxSnapshot, error) {
node.IsCurrent = true
} else {
matches := SnapshotNamePartsRe.FindStringSubmatch(txt)
if matches[1] == "Name" {
if len(matches) >= 2 && matches[1] == "Name" {
if nil == rootNode {
node = new(VBoxSnapshot)
rootNode = node