浏览代码

Merge pull request #1185 from ulyssessouza/fix-array-out-of-bounds

Add defensive code
Guillaume Tardif 4 年之前
父节点
当前提交
1693fbdf34
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      local/compose/create.go

+ 3 - 0
local/compose/create.go

@@ -315,6 +315,9 @@ func getVolumesFrom(project *types.Project, volumesFrom []string) ([]string, []s
 	}
 	for _, vol := range volumesFrom {
 		spec := strings.Split(vol, ":")
+		if len(spec) == 0 {
+			continue
+		}
 		if spec[0] == "container" {
 			volumes = append(volumes, strings.Join(spec[1:], ":"))
 			continue