fix: Nil binding on entity logs caused a NPE
This commit is contained in:
parent
912e6cfeb0
commit
0e0bbd3fdb
|
|
@ -307,11 +307,11 @@ func (api *oliveTinAPI) internalLogEntryToPb(logEntry *executor.InternalLogEntry
|
|||
ExecutionStarted: logEntry.ExecutionStarted,
|
||||
ExecutionFinished: logEntry.ExecutionFinished,
|
||||
User: logEntry.Username,
|
||||
BindingId: logEntry.Binding.ID,
|
||||
BindingId: logEntry.GetBindingId(),
|
||||
DatetimeRateLimitExpires: calculateRateLimitExpires(api, logEntry),
|
||||
}
|
||||
|
||||
if !pble.ExecutionFinished {
|
||||
if !pble.ExecutionFinished && logEntry.Binding != nil && logEntry.Binding.Action != nil {
|
||||
pble.CanKill = acl.IsAllowedKill(api.cfg, authenticatedUser, logEntry.Binding.Action)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -111,6 +111,15 @@ type InternalLogEntry struct {
|
|||
ActionIcon string
|
||||
}
|
||||
|
||||
// .Binding can be nil, so we need to handle that.
|
||||
func (e *InternalLogEntry) GetBindingId() string {
|
||||
if e.Binding == nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
return e.Binding.ID
|
||||
}
|
||||
|
||||
type executorStepFunc func(*ExecutionRequest) bool
|
||||
|
||||
// DefaultExecutor returns an Executor, with a sensible "chain of command" for
|
||||
|
|
|
|||
Loading…
Reference in New Issue