Skip to content

SfxMan class in endless tunnel doesn't ever initialize mInitOk if there is an error during initialization #960

@Mis012

Description

@Mis012

It seems that mInitOk is supposed to only be set to true when initialization is successful, however it is never initialized otherwise so when initialization is not successful, it's value is undefined. In practice, this causes a random crash when the memory where it's stored happens to contain something other than 0.

The following should probably fix it, but feel free to implement a different fix.
Considering the triviality of the following change, it's clearly exempted from copyright so I shouldn't need to deal with
any CLA should you wish to use this fix.

diff --git a/endless-tunnel/app/src/main/cpp/sfxman.hpp b/endless-tunnel/app/src/main/cpp/sfxman.hpp
index bc72a90..b604553 100644
--- a/endless-tunnel/app/src/main/cpp/sfxman.hpp
+++ b/endless-tunnel/app/src/main/cpp/sfxman.hpp
@@ -30,7 +30,7 @@
  * to a more complex game. */
 class SfxMan {
  private:
-  bool mInitOk;
+  bool mInitOk = 0;
   SLAndroidSimpleBufferQueueItf mPlayerBufferQueue;
 
  public:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions