Skip to content

Commit

Permalink
Fix possible null dereference (#4578)
Browse files Browse the repository at this point in the history
The return value of the function ```viewpoint_lower()``` is always checked for NULL.
On the other hand, the check ```if(a == NULL)``` was meaningless because the pointer ```a``` was previously dereferenced in ```viewpoint_lower(a)```.
  • Loading branch information
peter15914 authored Jan 5, 2025
1 parent 86622ba commit 115143f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libponyc/type/compattype.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static bool is_arrow_compat_nominal(ast_t* a, ast_t* b)
// T1->T2 ~ N k
ast_t* a_lower = viewpoint_lower(a);

if(a == NULL)
if(a_lower == NULL)
return false;

bool ok = is_compat_type(a_lower, b);
Expand Down

0 comments on commit 115143f

Please sign in to comment.