diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-08-07 13:49:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-07 13:49:33 +0200 |
commit | ba541bceca806a53070a4fd54955ac4a63c1633a (patch) | |
tree | a03f55aa6d660a7c3659705348842a3e5b208e54 /scene/resources | |
parent | 904e3100aceee7560e24ae1293c5b8a1e6201d55 (diff) | |
parent | e0b5b218638df5b7b2998233182a7d8a1118e717 (diff) |
Merge pull request #31077 from qarmin/coverity_bugs
Change some code proposed by Coverity and Cppcheck
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/dynamic_font.cpp | 2 | ||||
-rw-r--r-- | scene/resources/font.cpp | 1 | ||||
-rw-r--r-- | scene/resources/theme.h | 2 |
3 files changed, 3 insertions, 2 deletions
diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp index 8ee9879055..58fd883b0d 100644 --- a/scene/resources/dynamic_font.cpp +++ b/scene/resources/dynamic_font.cpp @@ -494,7 +494,7 @@ DynamicFontAtSize::Character DynamicFontAtSize::_bitmap_to_character(FT_Bitmap b int byte = i * bitmap.pitch + (j >> 3); int bit = 1 << (7 - (j % 8)); wr[ofs + 0] = 255; //grayscale as 1 - wr[ofs + 1] = bitmap.buffer[byte] & bit ? 255 : 0; + wr[ofs + 1] = (bitmap.buffer[byte] & bit) ? 255 : 0; } break; case FT_PIXEL_MODE_GRAY: wr[ofs + 0] = 255; //grayscale as 1 diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index 627397f0ab..a29e25174d 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -133,6 +133,7 @@ PoolVector<int> BitmapFont::_get_chars() const { while ((key = char_map.next(key))) { const Character *c = char_map.getptr(*key); + ERR_FAIL_COND_V(!c, PoolVector<int>()); chars.push_back(*key); chars.push_back(c->texture_idx); chars.push_back(c->rect.position.x); diff --git a/scene/resources/theme.h b/scene/resources/theme.h index 4c4f9b5aba..d27180e9eb 100644 --- a/scene/resources/theme.h +++ b/scene/resources/theme.h @@ -139,7 +139,7 @@ public: static void set_default(const Ref<Theme> &p_default); static Ref<Theme> get_project_default(); - static void set_project_default(const Ref<Theme> &p_default); + static void set_project_default(const Ref<Theme> &p_project_default); static void set_default_icon(const Ref<Texture> &p_icon); static void set_default_style(const Ref<StyleBox> &p_style); |