top | item 42177344

(no title)

convivialdingo | 1 year ago

I guarantee that piece of code has a comment like

  /* This should never happen */
  if (waypoints.matchcount > 2) {

discuss

order

crubier|1 year ago

Possibly even just

    waypoint = waypointsMatches[0]
Without even mentioning that waypointsMatches might have multiple elements.

This is why I always consider [0] to be a code smell. It doesn't have a name afaik, but it should.

CaptainFever|1 year ago

Silently ignoring conditions where there are multiple or zero elements?

dx034|1 year ago

From the text it sounds like it looked up if a code was in the flight plan and at which position it was in the plan. It never looked up two codes or assumed there code only be one, just comparing how the plan was filed.

I'm sure there'd be a better way to handle this, but it sounds to me like the system failed in a graceful way and acted as specified.

gitaarik|1 year ago

Don't you mean > 1 ?