diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-06-24 18:34:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-24 18:34:23 +0200 |
commit | 908a50739a380fca047e348656c12335a7bb52e2 (patch) | |
tree | c7aff137e37b68f1b188e4a728eee4f1418c07d4 | |
parent | 368b34482c346add9be2b3ec9fc5ce20322d67e1 (diff) | |
parent | 33c15799c77f2911470b5b9fa16ab73225661ee1 (diff) |
Merge pull request #30031 from qarmin/prevent_setting_bad_index_enums
Set to enum variables, only correct values
-rw-r--r-- | scene/3d/sprite_3d.cpp | 1 | ||||
-rw-r--r-- | scene/resources/texture.cpp | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index 6b70eef662..9f73484b6a 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -163,6 +163,7 @@ float SpriteBase3D::get_opacity() const { void SpriteBase3D::set_axis(Vector3::Axis p_axis) { + ERR_FAIL_INDEX(p_axis, 3); axis = p_axis; _queue_update(); } diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 6e0bc43296..3a0144849a 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -1502,6 +1502,7 @@ void CubeMap::set_side(Side p_side, const Ref<Image> &p_image) { Ref<Image> CubeMap::get_side(Side p_side) const { + ERR_FAIL_INDEX_V(p_side, 6, Ref<Image>()); if (!valid[p_side]) return Ref<Image>(); return VS::get_singleton()->texture_get_data(cubemap, VS::CubeMapSide(p_side)); |