summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/xdsserver/apiv1-folders.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/xdsserver/apiv1-folders.go b/lib/xdsserver/apiv1-folders.go
index b29613c..cac83ab 100644
--- a/lib/xdsserver/apiv1-folders.go
+++ b/lib/xdsserver/apiv1-folders.go
@@ -78,7 +78,9 @@ func (s *APIService) addFolder(c *gin.Context) {
fd.WriteString("export XDS_PROJECT_ID=" + newFld.ID + "\n")
if newFld.DefaultSdk == "" {
sdks := s.sdks.GetAll()
- newFld.DefaultSdk = sdks[0].ID
+ if len(sdks) > 0 {
+ newFld.DefaultSdk = sdks[0].ID
+ }
}
fd.WriteString("export XDS_SDK_ID=" + newFld.DefaultSdk + "\n")
fd.Close()