Hello @adenisonafifi,
You are right that this is not a good coding pattern. We have a rule that deals with null pointer dereference, but it is not triggered in this situation. Since the pattern on how to use weak_ptr
is pretty specific, we could also have a dedicated rule.
I created a ticket to improve this situation.
Thank you for reporting it.