From 2cf93df918829e380d2d9b2e6a5fa3951cc289c4 Mon Sep 17 00:00:00 2001
From: Alessandro Simovic <alessandro@yuneecresearch.com>
Date: Tue, 23 Jan 2018 10:02:07 +0100
Subject: [PATCH] libtunes: _repeat was uninitialized. Defaulting to false now.

Bugfix: This fixes a bug where libtunes might indicate that there are more tones to play even after the last note of a tune.
---
 src/lib/tunes/tunes.cpp | 1 +
 src/lib/tunes/tunes.h   | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/lib/tunes/tunes.cpp b/src/lib/tunes/tunes.cpp
index 643ec41d5b..d0b4646038 100644
--- a/src/lib/tunes/tunes.cpp
+++ b/src/lib/tunes/tunes.cpp
@@ -88,6 +88,7 @@ void Tunes::config_tone(bool repeat_flag)
 int Tunes::set_control(const tune_control_s &tune_control)
 {
 	bool reset_playing_tune = false;
+	_repeat = false;
 
 	if (tune_control.tune_id < _default_tunes_size) {
 		switch (tune_control.tune_id) {
diff --git a/src/lib/tunes/tunes.h b/src/lib/tunes/tunes.h
index f384c8b271..f8a27280e0 100644
--- a/src/lib/tunes/tunes.h
+++ b/src/lib/tunes/tunes.h
@@ -96,7 +96,7 @@ private:
 	static const char *_default_tunes[];
 	static const uint8_t _note_tab[];
 	static const unsigned int _default_tunes_size;
-	bool _repeat;	///< if true, tune restarts at end
+	bool _repeat = false;	     ///< if true, tune restarts at end
 
 	const char *_tune = nullptr; ///< current tune string
 	const char *_next = nullptr; ///< next note in the string
-- 
GitLab