aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-11-30 22:35:51 +0100
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-11-30 23:15:57 +0100
commitdf1af33ecdd4295171c4efa116c62a03f39df881 (patch)
tree4d738d6f7d18da74225a44126db473ffaa7c4bcd
parent9fb41a3693eeaac9adea71112232abaafea54c8f (diff)
Fix null pointer exception when no sdk installed.v1.0.0-rc1
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
-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()