project_files/HedgewarsMobile/Classes/ObjcExports.m
changeset 4504 8906b2409d97
parent 4488 e83216eba1db
child 4507 0f9b86942c19
--- a/project_files/HedgewarsMobile/Classes/ObjcExports.m	Sat Dec 11 01:00:00 2010 +0100
+++ b/project_files/HedgewarsMobile/Classes/ObjcExports.m	Sat Dec 11 01:55:16 2010 +0100
@@ -96,6 +96,7 @@
 }
 
 void clearView() {
+    // don't use any engine calls here as this function is called every time the ammomenu is opened
     UIWindow *theWindow = (IS_DUALHEAD()) ? [SDLUIKitDelegate sharedAppDelegate].uiwindow : [[UIApplication sharedApplication] keyWindow];
     UIButton *theButton = (UIButton *)[theWindow viewWithTag:CONFIRMATION_TAG];
     UISegmentedControl *theSegment = (UISegmentedControl *)[theWindow viewWithTag:GRENADE_TAG];
@@ -166,6 +167,7 @@
             gAudioSessionInited = YES;
     }
     UInt32 propertySize = sizeof(CFStringRef);
+    BOOL muteResult = NO;
 
     // this checks if there is volume
     Float32 volume;
@@ -179,9 +181,10 @@
     n = AudioSessionGetProperty(kAudioSessionProperty_AudioRoute, &propertySize, &state);
     if (n != 0)
         DLog( @"AudioSessionGetProperty 'audioRoute': %d", n );
-    NSString *result = (NSString *)state;
-    BOOL muteResult = ([result length] == 0);
-    releaseAndNil(result);
-    
+    else {
+        NSString *result = (NSString *)state;
+        muteResult = ([result length] == 0);
+        releaseAndNil(result);
+    }
     return volumeResult || muteResult;
 }