PATCH: Fix bug where headers are not editable in loaded .httpclient files.

  1 post   Feedicon  
Replies: 0 - Last Post: December 17, 2009 20:59
by: mlaster
showing 1 - 1 of 1
 
Posted: December 17, 2009 20:59 by mlaster
Index: src/HCDocument.h
===================================================================
--- src/HCDocument.h	(revision 70)
+++ src/HCDocument.h	(working copy)
@@ -11,7 +11,7 @@
 
 @interface HCDocument : NSDocument {
     HCWindowController *windowController;
-	NSDictionary *config;
+	NSMutableDictionary *config;
 }
 @property (nonatomic, retain) HCWindowController *windowController;
 @end
Index: src/HCWindowController.m
===================================================================
--- src/HCWindowController.m	(revision 70)
+++ src/HCWindowController.m	(working copy)
@@ -577,11 +577,19 @@
 
 
 - (NSInteger)numberOfItemsInComboBoxCell:(NSComboBoxCell *)cell {
+    
     BOOL isValueCell = [cell tag];
+    
     if (isValueCell) {
-        NSDictionary *header = [[headersController selectedObjects] objectAtIndex:0];
-        NSString *name = [[header objectForKey:@"name"] lowercaseString];
+        NSArray *selectedObjects = [headersController selectedObjects];
+        NSDictionary *header = nil;
+        NSString *name = nil;
         
+        if ([selectedObjects count] > 0) {
+             header = [[headersController selectedObjects] objectAtIndex:0];
+        }
+        name = [[header objectForKey:@"name"] lowercaseString];
+        
         if ([self isNameRequiringTodaysDateString:name]) {
             return 1;
         } else {
Index: src/HCDocument.m
===================================================================
--- src/HCDocument.m	(revision 70)
+++ src/HCDocument.m	(working copy)
@@ -75,7 +75,7 @@
 - (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error:(NSError **)outError {
     BOOL result = YES;
     @try {
-        self.config = [NSKeyedUnarchiver unarchiveObjectWithData:data];
+        self.config = [[[NSKeyedUnarchiver unarchiveObjectWithData:data] mutableCopy] autorelease];
         if (!config) [NSException raise:@"UnknownError" format:nil];
     } @catch (NSException *e) {
         *outError = [NSError errorWithDomain:NSOSStatusErrorDomain code:readErr userInfo:[e userInfo]];
 
Replies: 0 - Last Post: December 17, 2009 20:59
by: mlaster
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120127.ac94057)
 
 
Close
loading
Please Confirm
Close