- Fix for loading non-existing missions in MissionTrainingViewController ios-revival
authorantonc27 <antonc27@mail.ru>
Sat, 24 Oct 2015 03:56:02 +0200
branchios-revival
changeset 11243 a954853e9c00
parent 11242 e529b597f9d1
child 11244 57891137ffef
- Fix for loading non-existing missions in MissionTrainingViewController
project_files/HedgewarsMobile/Classes/MissionTrainingViewController.m
--- a/project_files/HedgewarsMobile/Classes/MissionTrainingViewController.m	Sat Oct 24 02:26:54 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/MissionTrainingViewController.m	Sat Oct 24 03:56:02 2015 +0200
@@ -135,6 +135,13 @@
             NSUInteger firstDotLocation = [line rangeOfString:@"."].location;
             
             NSString *missionID = [line substringToIndex:firstDotLocation];
+            
+            NSString *missionFullPath = [NSString stringWithFormat:@"%@%@.lua", TRAININGS_DIRECTORY(), missionID];
+            if (![[NSFileManager defaultManager] fileExistsAtPath:missionFullPath])
+            {
+                continue;
+            }
+            
             NSString *nameOrDesc = [line substringFromIndex:firstDotLocation+1];
             
             NSString *missionParsedName = ([nameOrDesc hasPrefix:@"name="]) ? [nameOrDesc stringByReplacingOccurrencesOfString:@"name=" withString:@""] : nil;