From ca5b9f9fe9eee2a3cb435d6d6f129f9a1ecf4c0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=87=91=E8=81=96=E8=BC=9D?= Date: Wed, 15 Jul 2015 14:36:55 +0900 Subject: [PATCH] fixed Xcode crash bug #14 --- KSHObjcUML/KSHObjcUML.m | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/KSHObjcUML/KSHObjcUML.m b/KSHObjcUML/KSHObjcUML.m index dabb13d..79a8a7c 100644 --- a/KSHObjcUML/KSHObjcUML.m +++ b/KSHObjcUML/KSHObjcUML.m @@ -46,22 +46,38 @@ + (NSBundle *)pluginBundle - (NSString *)scriptPath { - return [[self.directoryPath stringByAppendingPathComponent:FOLDAR_NAME] stringByAppendingPathComponent:@"script.rb"]; + NSString *tempScriptPath = [[self.directoryPath stringByAppendingPathComponent:FOLDAR_NAME] stringByAppendingPathComponent:@"script.rb"]; + if (tempScriptPath) { + _scriptPath = tempScriptPath; + } + return _scriptPath; } - (NSString *)projectName { - return [VWKProject projectForKeyWindow].projectOriginalName; + NSString *tempProjectName = [VWKProject projectForKeyWindow].projectOriginalName; + if (tempProjectName) { + _projectName = tempProjectName; + } + return _projectName; } - (NSString *)zipFilePath { - return [[KSHObjcUML pluginBundle] pathForResource:FOLDAR_NAME ofType:@"zip"]; + NSString *tempZipFilePath = [[KSHObjcUML pluginBundle] pathForResource:FOLDAR_NAME ofType:@"zip"]; + if (tempZipFilePath) { + _zipFilePath = tempZipFilePath; + } + return _zipFilePath; } - (NSString *)directoryPath { - return [VWKProject projectForKeyWindow].directoryPath; + NSString *tempDirectoryPath = [VWKProject projectForKeyWindow].directoryPath; + if (tempDirectoryPath) { + _directoryPath = tempDirectoryPath; + } + return _directoryPath; } + (void)pluginDidLoad:(NSBundle *)plugin