diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-04-04 15:06:57 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-04-04 19:49:50 +0200 |
commit | f8ab79e68af20e18e1d868b64d6dfd0c429bc554 (patch) | |
tree | a9d2df2e2df939c189135b1c36a01e06b37b80b2 /modules/navigation | |
parent | 53317bbe146dd19a919685df8d846c55568daba1 (diff) |
Zero initialize all pointer class and struct members
This prevents the pitfall of UB when checking if they have been
assigned something valid by comparing to nullptr.
Diffstat (limited to 'modules/navigation')
-rw-r--r-- | modules/navigation/editor/navigation_mesh_editor_plugin.h | 14 | ||||
-rw-r--r-- | modules/navigation/nav_utils.h | 2 |
2 files changed, 8 insertions, 8 deletions
diff --git a/modules/navigation/editor/navigation_mesh_editor_plugin.h b/modules/navigation/editor/navigation_mesh_editor_plugin.h index 3c3e804fd2..bc9e4185b7 100644 --- a/modules/navigation/editor/navigation_mesh_editor_plugin.h +++ b/modules/navigation/editor/navigation_mesh_editor_plugin.h @@ -42,14 +42,14 @@ class NavigationMeshEditor : public Control { GDCLASS(NavigationMeshEditor, Control); - AcceptDialog *err_dialog; + AcceptDialog *err_dialog = nullptr; - HBoxContainer *bake_hbox; - Button *button_bake; - Button *button_reset; - Label *bake_info; + HBoxContainer *bake_hbox = nullptr; + Button *button_bake = nullptr; + Button *button_reset = nullptr; + Label *bake_info = nullptr; - NavigationRegion3D *node; + NavigationRegion3D *node = nullptr; void _bake_pressed(); void _clear_pressed(); @@ -68,7 +68,7 @@ public: class NavigationMeshEditorPlugin : public EditorPlugin { GDCLASS(NavigationMeshEditorPlugin, EditorPlugin); - NavigationMeshEditor *navigation_mesh_editor; + NavigationMeshEditor *navigation_mesh_editor = nullptr; public: virtual String get_name() const override { return "NavigationMesh"; } diff --git a/modules/navigation/nav_utils.h b/modules/navigation/nav_utils.h index 0c02885b10..5b6c695ca4 100644 --- a/modules/navigation/nav_utils.h +++ b/modules/navigation/nav_utils.h @@ -89,7 +89,7 @@ struct Edge { }; struct Polygon { - NavRegion *owner; + NavRegion *owner = nullptr; /// The points of this `Polygon` std::vector<Point> points; |