summaryrefslogtreecommitdiff
path: root/src/displayapp
diff options
context:
space:
mode:
authorReinhold Gschweicher <pyro4hell@gmail.com>2022-01-23 23:34:25 +0100
committerReinhold Gschweicher <pyro4hell@gmail.com>2022-01-23 23:39:38 +0100
commit314c02194a19016d83fb71a41f6f647959b7be1e (patch)
tree69a7d78599855d35afac8701eab2f4683ada23b8 /src/displayapp
parent26ae828e393d28390c5ea718bec9d4c1a96435ac (diff)
Music: initialize totalLength to have non-random data from the start
In the first `Music::Refresh` call the lastLength and totalLength are not initialized. The `lastLength` value is read first from the musicService. Naturally in the first itereation that is changed and `UpdateLength()` is called. There the variable `totalLength` is used as well, but that variable isn't initialed to a sensible value yet. This leads to sometimes the `Music.h` screen segfaulting (depending on the random uninitialized data in the `lastLength` variable)
Diffstat (limited to 'src/displayapp')
-rw-r--r--src/displayapp/screens/Music.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/displayapp/screens/Music.h b/src/displayapp/screens/Music.h
index f9b4eaab..35f7bab5 100644
--- a/src/displayapp/screens/Music.h
+++ b/src/displayapp/screens/Music.h
@@ -69,7 +69,7 @@ namespace Pinetime {
std::string track;
/** Total length in seconds */
- int totalLength;
+ int totalLength = 0;
/** Current length in seconds */
int currentLength;
/** Last length */