default_app_on_connection() question

I'm using SDK 6.0.18.1182.1. The start of default_app_on_connection() looks like this

void default_app_on_connection(uint8_t conidx, struct gapc_connection_req_ind const *param)
{
    if (app_env[conidx].conidx != GAP_INVALID_CONIDX)
    {
        ...

GAP_INVALID_CONIDX is defined as 0xFF in gap.h

So if default_app_on_connection is called with conidx == GAP_INVALID_CONIDX then this would read app_env[0xff] right? Or am I misunderstanding?

Should it say if(conidx != GAP_INVALID_CONIDX) instead? Or should we do our own checking before calling default_app_on_connection()?