title: Thread 1: EXC_BAD_ACCESS (code=1, address=0x48) error when trying to play audio
body: <p>I am trying to play an audio file when a button is pressed in Xcode. I have gotten this to work in a previous project(that was in an earlier version of Xcode), however now when I try to do it I get the error on the line <code>player.play()</code>. I have my file saved in the main bundle.</p>
  
  <blockquote>
    <p>Thread 1: EXC_BAD_ACCESS (code=1, address=0x48)</p>
  </blockquote>
  
  <pre><code>func playExpression(_ word: String){
  
      //sets up the audio player for the word
      var player:AVAudioPlayer = AVAudioPlayer()
  
      do {
          //gets the audio file and links it to the player.
          let path = Bundle.main.path(forResource: word, ofType: "mp3")
          try player = AVAudioPlayer(contentsOf: NSURL(fileURLWithPath: path!) as URL)
      }
      catch {
          /*ERROR*/
      }
  
      //plays the  audio clip
      player.play()
      print("audio played")
      sleep(UInt32(1)) //gives the audio clip time to play
  }
  
  @IBAction func speakerPressed(_ sender: UIButton) {
          playExpression("testaudio")
      }
  </code></pre>
  
  <p>UPDATE: The audio file I was trying to play was corrupted, causing it to crash. Once I changed the file, it did play.</p>