how to replace the part of string from NSMutablestring
<p>Iam developing one application.In that i take the string from array and replace .xml from that string and go to next page.And if i come back and execute that code the application will be crashed at that replace string line.Below is my code.</p>

<pre><code>  -(void)open:(UITapGestureRecognizer*)recognizer
  {
       NSInteger i=(recognizer).view.tag;
       NSMutableString *s1=[listoflessons objectAtIndex:i];
       [default1 setObject:s1 forKey:@"KeyToXmlFile"];
       NSLog(@"%@",[default1 objectForKey:@"KeyToXmlFile"]);
        [s1 replaceCharactersInRange:[s1 rangeOfString: @".xml"] withString: @""];
        [default1 setObject:s1 forKey:@"KeyToSelectedFile"];
        [listoflessons removeObjectAtIndex:i];
      [listoflessons insertObject:[default1 objectForKey:@"KeyToXmlFile"] atIndex:i];
        NSLog(@"%@",listoflessons);
       SecondViewCOntroller *snd=[[SecondViewCOntroller    alloc]initWithNibName:@"SecondViewCOntroller" bundle:nil];
       [self.navigationController pushViewController:snd animated:YES];
      }
</code></pre>

<p>so please tell me how to avoid that one.</p>
