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)
This commit is contained in:
parent
26ae828e39
commit
314c02194a
|
@ -69,7 +69,7 @@ namespace Pinetime {
|
||||||
std::string track;
|
std::string track;
|
||||||
|
|
||||||
/** Total length in seconds */
|
/** Total length in seconds */
|
||||||
int totalLength;
|
int totalLength = 0;
|
||||||
/** Current length in seconds */
|
/** Current length in seconds */
|
||||||
int currentLength;
|
int currentLength;
|
||||||
/** Last length */
|
/** Last length */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user