aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2012-03-04 19:07:52 +0000
committerstuconnolly <stuart02@gmail.com>2012-03-04 19:07:52 +0000
commitc9ac1028d6b430de61b376257beee1d5747c7783 (patch)
tree2c48f5ce5fe569508145f881fb73c592937a3990
parent2483cd22f74239d2a06c83f1c5d9a25eaab44a7c (diff)
downloadsequelpro-c9ac1028d6b430de61b376257beee1d5747c7783.tar.gz
sequelpro-c9ac1028d6b430de61b376257beee1d5747c7783.tar.bz2
sequelpro-c9ac1028d6b430de61b376257beee1d5747c7783.zip
Fix exception caused by adding a nil representation of a tree node.
-rw-r--r--Source/SPConnectionControllerDelegate.m12
1 files changed, 7 insertions, 5 deletions
diff --git a/Source/SPConnectionControllerDelegate.m b/Source/SPConnectionControllerDelegate.m
index 11d092f4..12a364f0 100644
--- a/Source/SPConnectionControllerDelegate.m
+++ b/Source/SPConnectionControllerDelegate.m
@@ -170,7 +170,7 @@ static NSString *SPDatabaseImage = @"database-small";
}
[pboard declareTypes:[NSArray arrayWithObject:SPFavoritesPasteboardDragType] owner:self];
- [pboard setData:[NSData data] forType:SPFavoritesPasteboardDragType];
+ [pboard setData:[NSKeyedArchiver archivedDataWithRootObject:items] forType:SPFavoritesPasteboardDragType];
return YES;
}
@@ -196,8 +196,8 @@ static NSString *SPDatabaseImage = @"database-small";
BOOL acceptedDrop = NO;
if ((!item) || ([info draggingSource] != outlineView)) return acceptedDrop;
-
- SPTreeNode *node = (item) ? item : [[[[favoritesRoot childNodes] objectAtIndex:0] childNodes] objectAtIndex:0];
+
+ SPTreeNode *node = item ? item : [[[[favoritesRoot childNodes] objectAtIndex:0] childNodes] objectAtIndex:0];
// Disable all automatic sorting
currentSortItem = -1;
@@ -212,8 +212,10 @@ static NSString *SPDatabaseImage = @"database-small";
[menuItem setState:NSOffState];
}
- NSArray *nodes = [self selectedFavoriteNodes];
-
+ NSArray *nodes = [NSKeyedUnarchiver unarchiveObjectWithData:[[info draggingPasteboard] dataForType:SPFavoritesPasteboardDragType]];
+
+ if (![nodes count]) return acceptedDrop;
+
if ([node isGroup]) {
if (index == NSOutlineViewDropOnItemIndex) {
index = 0;