Game-as-a-Service / Machi-Koro-Cpp

5 stars 1 forks source link

[Presenter] InitGame cause Segmentation fault if game id not exist #41

Open angtsusiong opened 6 months ago

angtsusiong commented 6 months ago

https://github.com/Game-as-a-Service/Machi-Koro-Cpp/blob/f386ef9491fc5017e7f1cfcb1b8e2cce0398b51f/usecases/init_game.cpp#L18-L31

https://github.com/Game-as-a-Service/Machi-Koro-Cpp/blob/f386ef9491fc5017e7f1cfcb1b8e2cce0398b51f/models/events/init_game_event.h#L42-L55 https://github.com/Game-as-a-Service/Machi-Koro-Cpp/blob/f386ef9491fc5017e7f1cfcb1b8e2cce0398b51f/presenters/init_game_present.cpp#L48

Some call by nullptr.

angtsusiong commented 6 months ago

image image image

Check nullptr before call solve this issue.