Skip to content

Commit 0441fc7

Browse files
committed
Fixes #11
1 parent 829f11b commit 0441fc7

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

SCXcodeMinimap/SCXcodeMinimap.m

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,26 @@ + (void)pluginDidLoad:(NSBundle *)plugin {
3232
}
3333

3434
- (id)init {
35-
if (self = [super init]) {
35+
if (self = [super init]) {
36+
37+
[self createMenuItem];
38+
3639
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onDidFinishSetup:) name:IDESourceCodeEditorDidFinishSetupNotification object:nil];
3740
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onDocumentDidChange:) name:IDEEditorDocumentDidChangeNotification object:nil];
3841
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onCodeEditorBoundsChange:) name:IDESourceCodeEditorTextViewBoundsDidChangeNotification object:nil];
39-
[self createMenuItem];
4042
}
4143
return self;
4244
}
4345

4446
- (void)createMenuItem
4547
{
4648
NSMenuItem *editMenuItem = [[NSApp mainMenu] itemWithTitle:@"View"];
49+
50+
if(editMenuItem == nil) {
51+
NSLog(@"Could not fetch 'View' main menu item");
52+
return;
53+
}
54+
4755
NSMenuItem *miniMapItem = [[NSMenuItem alloc] initWithTitle:@""
4856
action:NULL
4957
keyEquivalent:@"M"];

0 commit comments

Comments
 (0)