Skip to content

Commit ca5b9f9

Browse files
author
金聖輝
committed
fixed Xcode crash bug #14
1 parent 2fb4797 commit ca5b9f9

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

KSHObjcUML/KSHObjcUML.m

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,38 @@ + (NSBundle *)pluginBundle
4646

4747
- (NSString *)scriptPath
4848
{
49-
return [[self.directoryPath stringByAppendingPathComponent:FOLDAR_NAME] stringByAppendingPathComponent:@"script.rb"];
49+
NSString *tempScriptPath = [[self.directoryPath stringByAppendingPathComponent:FOLDAR_NAME] stringByAppendingPathComponent:@"script.rb"];
50+
if (tempScriptPath) {
51+
_scriptPath = tempScriptPath;
52+
}
53+
return _scriptPath;
5054
}
5155

5256
- (NSString *)projectName
5357
{
54-
return [VWKProject projectForKeyWindow].projectOriginalName;
58+
NSString *tempProjectName = [VWKProject projectForKeyWindow].projectOriginalName;
59+
if (tempProjectName) {
60+
_projectName = tempProjectName;
61+
}
62+
return _projectName;
5563
}
5664

5765
- (NSString *)zipFilePath
5866
{
59-
return [[KSHObjcUML pluginBundle] pathForResource:FOLDAR_NAME ofType:@"zip"];
67+
NSString *tempZipFilePath = [[KSHObjcUML pluginBundle] pathForResource:FOLDAR_NAME ofType:@"zip"];
68+
if (tempZipFilePath) {
69+
_zipFilePath = tempZipFilePath;
70+
}
71+
return _zipFilePath;
6072
}
6173

6274
- (NSString *)directoryPath
6375
{
64-
return [VWKProject projectForKeyWindow].directoryPath;
76+
NSString *tempDirectoryPath = [VWKProject projectForKeyWindow].directoryPath;
77+
if (tempDirectoryPath) {
78+
_directoryPath = tempDirectoryPath;
79+
}
80+
return _directoryPath;
6581
}
6682

6783
+ (void)pluginDidLoad:(NSBundle *)plugin

0 commit comments

Comments
 (0)