S3_0 (but other branches likely affected): unit_select_dialog_popup() does unit_tile(pUnit). Clang analyzer is worried that it causes reference through NULL pUnit. That's not real problem, as if the tile unit list size is zero, we never reach that part, and pUnit is the topmost unit in the stack.
However, the code makes no sense, either. We already know that the unit is in the list of the original ptile, so certainly its tile is ptile. No need to seek for that. If that was not the case, we would be looking value from effectively random unit from the stack like representing all of them.
S3_0 (but other branches likely affected): unit_select_dialog_popup() does unit_tile(pUnit). Clang analyzer is worried that it causes reference through NULL pUnit. That's not real problem, as if the tile unit list size is zero, we never reach that part, and pUnit is the topmost unit in the stack.
However, the code makes no sense, either. We already know that the unit is in the list of the original ptile, so certainly its tile is ptile. No need to seek for that. If that was not the case, we would be looking value from effectively random unit from the stack like representing all of them.