fix(ui): Prevent crash from nil raster image for enabled modules
The diagonal stripe pattern raster function was returning nil for enabled modules, causing a nil pointer dereference when Fyne tried to process the texture. Fixed by always returning a valid image - transparent for enabled modules, striped for disabled modules. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
776ec1f672
commit
7954524bac
|
|
@ -179,10 +179,10 @@ func (m *ModuleTile) CreateRenderer() fyne.WidgetRenderer {
|
||||||
|
|
||||||
// Diagonal stripe overlay for disabled modules
|
// Diagonal stripe overlay for disabled modules
|
||||||
disabledStripe := canvas.NewRaster(func(w, h int) image.Image {
|
disabledStripe := canvas.NewRaster(func(w, h int) image.Image {
|
||||||
if m.enabled {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
img := image.NewRGBA(image.Rect(0, 0, w, h))
|
img := image.NewRGBA(image.Rect(0, 0, w, h))
|
||||||
|
|
||||||
|
// Only draw stripes if disabled
|
||||||
|
if !m.enabled {
|
||||||
// Semi-transparent dark stripes
|
// Semi-transparent dark stripes
|
||||||
darkStripe := color.NRGBA{R: 0, G: 0, B: 0, A: 100}
|
darkStripe := color.NRGBA{R: 0, G: 0, B: 0, A: 100}
|
||||||
lightStripe := color.NRGBA{R: 0, G: 0, B: 0, A: 30}
|
lightStripe := color.NRGBA{R: 0, G: 0, B: 0, A: 30}
|
||||||
|
|
@ -197,6 +197,8 @@ func (m *ModuleTile) CreateRenderer() fyne.WidgetRenderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// Return transparent image for enabled modules
|
||||||
return img
|
return img
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user