ho un problema con un programma.. c'è una funzione che non funziona correttamente..questa funzione non mi effettua il secondo if e non riesco a capire il motivo... mi restituisce sempre l'ultimo return NULL anche se si verifica quell'uguaglianza... qualcuno mi può aiutare?

questo è il codice:
codice:
int getString (int identifier)
{
    int i;
    StringPool *ptr;
          
    if(identifier<0) return NULL;
    else{
    i=0;
    while(i<DIMENSIONE_VETTORE){
    if(sp[i].identificatore == identifier){
    ptr->foundPos = i;
    return sp[i].stringa;}
    else i++;}
    if(i >= DIMENSIONE_VETTORE -1) return NULL;}
}