The following diff fixes a crash on first time launch.
I have not added as a commit as there is disagreement as to whether instead a blank file should be written:
index dfac0e1..1ec2686 100644
--- a/interface.go
+++ b/interface.go
@@ -67,11 +67,10 @@ func SetKey(currentKey *Key, i int) {
func SetPage(config *Config, page int, dev streamdeck.Device) {
p = page
currentPage := config.Pages[page]
- for i := 0; i < 15; i++ {
- currentKey := ¤tPage[i]
+ for i, currentKey := range currentPage {
if currentKey.Buff == nil {
if currentKey.IconHandler == "" {
- SetKey(currentKey, i)
+ SetKey(¤tKey, i)
} else if currentKey.IconHandlerStruct == nil {
var handler IconHandler
@@ -85,7 +84,7 @@ func SetPage(config *Config, page int, dev streamdeck.Device) {
if handler == nil {
continue
}
- handler.Icon(page, i, currentKey, dev)
+ handler.Icon(page, i, ¤tKey, dev)
currentKey.IconHandlerStruct = handler
}
} else {
diff --git a/main.go b/main.go
index 5c4a68d..80e84e3 100644
--- a/main.go
+++ b/main.go
@@ -38,7 +38,9 @@ func main() {
config.Pages = append(config.Pages, Page{})
}
cleanupHook()
- SetPage(config, 0, dev)
+ if len(config.Pages) > 0 {
+ SetPage(config, 0, dev)
+ }
go InitDBUS()
Listen()
}
~
The following diff fixes a crash on first time launch. I have not added as a commit as there is disagreement as to whether instead a blank file should be written: