opengles2: Fix static analysis warning.
authorRyan C. Gordon <icculus@icculus.org>
Thu, 21 Mar 2019 10:39:49 -0400
changeset 1266936ee99107390
parent 12668 dd6b61160cdc
child 12670 dcb6c57df2fc
opengles2: Fix static analysis warning.

Not clear if this could ever dereference NULL in real life, but better safe
than sorry!
src/render/opengles2/SDL_render_gles2.c
     1.1 --- a/src/render/opengles2/SDL_render_gles2.c	Tue Mar 19 17:20:54 2019 -0700
     1.2 +++ b/src/render/opengles2/SDL_render_gles2.c	Thu Mar 21 10:39:49 2019 -0400
     1.3 @@ -529,8 +529,10 @@
     1.4          }
     1.5          data->glDeleteProgram(data->program_cache.tail->id);
     1.6          data->program_cache.tail = data->program_cache.tail->prev;
     1.7 -        SDL_free(data->program_cache.tail->next);
     1.8 -        data->program_cache.tail->next = NULL;
     1.9 +        if (data->program_cache.tail != NULL) {
    1.10 +            SDL_free(data->program_cache.tail->next);
    1.11 +            data->program_cache.tail->next = NULL;
    1.12 +        }
    1.13          --data->program_cache.count;
    1.14      }
    1.15      return entry;