1
0
mirror of https://github.com/amir20/dozzle.git synced 2025-12-21 21:33:18 +01:00

fix: tries to fix nil pointer when container for event is not there

This commit is contained in:
Amir Raminfar
2025-03-05 08:44:04 -08:00
parent bb4dca2386
commit 36588f0937
2 changed files with 36 additions and 33 deletions

View File

@@ -1,7 +1,7 @@
/* eslint-disable */ /* eslint-disable */
/* prettier-ignore */ /* prettier-ignore */
// @ts-nocheck // @ts-nocheck
// Generated by unplugin-vue-router. ‼️ DO NOT MODIFY THIS FILE ‼️ // Generated by unplugin-vue-router. \u203C\uFE0F DO NOT MODIFY THIS FILE \u203C\uFE0F
// It's recommended to commit this file. // It's recommended to commit this file.
// Make sure to add this file to your tsconfig.json file as an "includes" or "files" entry. // Make sure to add this file to your tsconfig.json file as an "includes" or "files" entry.

View File

@@ -182,7 +182,7 @@ func (s *ContainerStore) FindContainer(id string, labels ContainerLabels) (Conta
return &newContainer, false return &newContainer, false
} else { } else {
log.Error().Err(err).Msg("failed to fetch container") log.Error().Err(err).Msg("failed to fetch container")
return c, false return c, true
} }
} }
return c, false return c, false
@@ -313,6 +313,9 @@ func (s *ContainerStore) init() {
s.containers.Delete(event.ActorID) s.containers.Delete(event.ActorID)
case "update": case "update":
if event.Container == nil {
log.Error().Interface("event", event).Msg("container update event with nil container")
} else {
started := false started := false
updatedContainer, _ := s.containers.Compute(event.ActorID, func(c *Container, loaded bool) (*Container, bool) { updatedContainer, _ := s.containers.Compute(event.ActorID, func(c *Container, loaded bool) (*Container, bool) {
if loaded { if loaded {
@@ -332,7 +335,6 @@ func (s *ContainerStore) init() {
return c, true return c, true
} }
}) })
if started { if started {
s.subscribers.Range(func(ctx context.Context, events chan<- ContainerEvent) bool { s.subscribers.Range(func(ctx context.Context, events chan<- ContainerEvent) bool {
select { select {
@@ -347,6 +349,7 @@ func (s *ContainerStore) init() {
return true return true
}) })
} }
}
case "die": case "die":
s.containers.Compute(event.ActorID, func(c *Container, loaded bool) (*Container, bool) { s.containers.Compute(event.ActorID, func(c *Container, loaded bool) (*Container, bool) {