Skip to content

Commit

Permalink
fix possible crash NULL access
Browse files Browse the repository at this point in the history
  • Loading branch information
SciLor committed Nov 8, 2023
1 parent 727d387 commit cb157c0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/contentJson.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,10 @@ error_t save_content_json(const char *content_path, contentJson_t *content_json)

void content_json_update_model(contentJson_t *content_json, uint32_t audio_id)
{
toniesJson_item_t *toniesJson = tonies_byAudioId(audio_id);
if (content_json->_valid && osStrcmp(content_json->tonie_model, toniesJson->model) != 0)
if (content_json->_valid)
{
if (toniesJson != NULL)
toniesJson_item_t *toniesJson = tonies_byAudioId(audio_id);
if (toniesJson != NULL && osStrcmp(content_json->tonie_model, toniesJson->model) != 0)
{
osFreeMem(content_json->tonie_model);
content_json->tonie_model = strdup(toniesJson->model);
Expand Down

0 comments on commit cb157c0

Please sign in to comment.