From 28b10ea66821e8de6c387a83c0218e006566079d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Mon, 17 Dec 2018 12:28:09 +0100 Subject: Fix sometimes uninitialized variable warning raised by Xcode 9.4.1 Fixes this warning raised by Travis CI on macOS: ``` editor/plugins/polygon_2d_editor_plugin.cpp:95:6: warning: variable 'skeleton' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (!node->has_node(node->get_skeleton())) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ editor/plugins/polygon_2d_editor_plugin.cpp:106:7: note: uninitialized use occurs here if (!skeleton) { ^~~~~~~~ editor/plugins/polygon_2d_editor_plugin.cpp:95:2: note: remove the 'if' if its condition is always false if (!node->has_node(node->get_skeleton())) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ editor/plugins/polygon_2d_editor_plugin.cpp:94:22: note: initialize the variable 'skeleton' to silence this warning Skeleton2D *skeleton; ^ = NULL ``` --- editor/plugins/polygon_2d_editor_plugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index 97448f3f88..91639a40f9 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -91,7 +91,7 @@ void Polygon2DEditor::_notification(int p_what) { void Polygon2DEditor::_sync_bones() { - Skeleton2D *skeleton; + Skeleton2D *skeleton = NULL; if (!node->has_node(node->get_skeleton())) { error->set_text(TTR("The skeleton property of the Polygon2D does not point to a Skeleton2D node")); error->popup_centered_minsize(); -- cgit v1.2.3