diff options
author | stuconnolly <stuart02@gmail.com> | 2012-05-02 14:12:07 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2012-05-02 14:12:07 +0000 |
commit | 10e797436aac4a33e1bee046be07286a5d6eb22a (patch) | |
tree | 0f66b64e068b6c7e3e2b64ff56792c94e00ecfdc | |
parent | 316e515bdb2144a193abdd973730b1e3c200b2c7 (diff) | |
download | sequelpro-10e797436aac4a33e1bee046be07286a5d6eb22a.tar.gz sequelpro-10e797436aac4a33e1bee046be07286a5d6eb22a.tar.bz2 sequelpro-10e797436aac4a33e1bee046be07286a5d6eb22a.zip |
Prevent connection initialization when there's no favorite selected.
-rw-r--r-- | Source/SPConnectionController.m | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m index ee3c74bc..f5929ff6 100644 --- a/Source/SPConnectionController.m +++ b/Source/SPConnectionController.m @@ -270,19 +270,21 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, #pragma mark Interface interaction /** - * Registered in initWithDocument: to be the double click action of the favorites outline view. + * Registered to be the double click action of the favorites outline view. */ - (IBAction)nodeDoubleClicked:(id)sender { SPTreeNode *node = [self selectedFavoriteNode]; - // Only proceed to initiate a connection if a leaf node (i.e. a favorite and not a group) was double clicked. - if (![node isGroup]) { - [self initiateConnection:self]; - } - // Otherwise start editing the group node's name - else { - [favoritesOutlineView editColumn:0 row:[favoritesOutlineView selectedRow] withEvent:nil select:YES]; + if (node) { + // Only proceed to initiate a connection if a leaf node (i.e. a favorite and not a group) was double clicked. + if (![node isGroup]) { + [self initiateConnection:self]; + } + // Otherwise start editing the group node's name + else { + [favoritesOutlineView editColumn:0 row:[favoritesOutlineView selectedRow] withEvent:nil select:YES]; + } } } |