Skip to content

Something seems wrong with indexing of a list #75

@MasWag

Description

@MasWag

Hi,

I find that there is a bug in DelayedDynamics.get_commands_at. Namely, it seems it causes the out-of-range issue when idx == len(a).

if idx > 0 and (idx == len(a) or math.fabs(t - a[idx - 1]) < math.fabs(t - a[idx])):
return idx, a[idx], self.commands[idx - 1]

I guess it should be a[idx-1] when idx == len(a). However, I am not sure if it is OK to simply replace this part with return idx, a[idx], self.commands[idx - 1] or we need another elsif to split the case of idx == len(a) and math.fabs(t - a[idx - 1]) < math.fabs(t - a[idx]).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions