summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/tile_map.cpp4
-rw-r--r--scene/animation/tween.cpp2
-rw-r--r--scene/gui/range.cpp2
-rw-r--r--scene/gui/tree.h2
-rw-r--r--scene/resources/audio_stream_sample.cpp5
5 files changed, 10 insertions, 5 deletions
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 173214dfe4..d75d8cfc55 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -1233,8 +1233,8 @@ void TileMap::_set_tile_data(const PoolVector<int> &p_data) {
}
#endif
- int16_t x = decode_uint16(&local[0]);
- int16_t y = decode_uint16(&local[2]);
+ uint16_t x = decode_uint16(&local[0]);
+ uint16_t y = decode_uint16(&local[2]);
uint32_t v = decode_uint32(&local[4]);
bool flip_h = v & (1 << 29);
bool flip_v = v & (1 << 30);
diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp
index a7d936fcd3..ce3f2b3b1a 100644
--- a/scene/animation/tween.cpp
+++ b/scene/animation/tween.cpp
@@ -63,6 +63,8 @@ void Tween::_add_pending_command(StringName p_key, const Variant &p_arg1, const
count = 2;
else if (p_arg1.get_type() != Variant::NIL)
count = 1;
+ else
+ count = 0;
// Add the specified arguments to the command
// TODO: Make this a switch statement?
diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp
index 9c016b5a50..362697b4ad 100644
--- a/scene/gui/range.cpp
+++ b/scene/gui/range.cpp
@@ -173,6 +173,8 @@ void Range::set_as_ratio(double p_value) {
}
double Range::get_as_ratio() const {
+ ERR_FAIL_COND_V_MSG(Math::is_equal_approx(get_max(), get_min()), 0.0, "Cannot get ratio when minimum and maximum value are equal.");
+
if (shared->exp_ratio && get_min() >= 0) {
double exp_min = get_min() == 0 ? 0.0 : Math::log(get_min()) / Math::log((double)2);
diff --git a/scene/gui/tree.h b/scene/gui/tree.h
index 361830173b..d5227f6e65 100644
--- a/scene/gui/tree.h
+++ b/scene/gui/tree.h
@@ -159,7 +159,7 @@ protected:
//bind helpers
Dictionary _get_range_config(int p_column) {
Dictionary d;
- double min, max, step;
+ double min = 0.0, max = 0.0, step = 0.0;
get_range_config(p_column, min, max, step);
d["min"] = min;
d["max"] = max;
diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp
index 5b61654c5d..286f9e37cd 100644
--- a/scene/resources/audio_stream_sample.cpp
+++ b/scene/resources/audio_stream_sample.cpp
@@ -95,8 +95,8 @@ void AudioStreamPlaybackSample::do_resample(const Depth *p_src, AudioFrame *p_ds
// this function will be compiled branchless by any decent compiler
int32_t final, final_r, next, next_r;
- while (amount--) {
-
+ while (amount) {
+ amount--;
int64_t pos = offset >> MIX_FRAC_BITS;
if (is_stereo && !is_ima_adpcm)
pos <<= 1;
@@ -444,6 +444,7 @@ int AudioStreamSample::get_loop_end() const {
void AudioStreamSample::set_mix_rate(int p_hz) {
+ ERR_FAIL_COND(p_hz == 0);
mix_rate = p_hz;
}
int AudioStreamSample::get_mix_rate() const {