Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Mis012 opened this issue Sep 15, 2023 · 0 comments

Comments

@Mis012
Copy link

Mis012 commented Sep 15, 2023

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:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant