From 14e64ef759976c105d901aa6fb7eeb25cccc1954 Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Thu, 13 Jul 2023 19:19:20 -0400 Subject: [PATCH] add nspopupbutton to nsmenu conditional to get itemArray --- GormCore/GormDocument.m | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/GormCore/GormDocument.m b/GormCore/GormDocument.m index 194ecadc..64b09e95 100644 --- a/GormCore/GormDocument.m +++ b/GormCore/GormDocument.m @@ -3343,25 +3343,29 @@ static void _real_close(GormDocument *self, if ([obj respondsToSelector: @selector(title)]) { NSString *title = [obj title]; - NSXMLElement *transunit = [NSXMLNode elementWithName: @"trans-unit"]; - NSString *objId = [NSString stringWithFormat: @"%@.title", name]; - - attr = [NSXMLNode attributeWithName: @"ib:key-path-category" - stringValue: @"string"]; - [transunit addAttribute: attr]; - attr = [NSXMLNode attributeWithName: @"ib:key-path" stringValue: @"title"]; - [transunit addAttribute: attr]; - attr = [NSXMLNode attributeWithName: @"id" stringValue: objId]; - [transunit addAttribute: attr]; - [group addChild: transunit]; - - NSXMLElement *source = [NSXMLNode elementWithName: @"source"]; - [source setStringValue: title]; - [transunit addChild: source]; + if (title != nil) + { + NSXMLElement *transunit = [NSXMLNode elementWithName: @"trans-unit"]; + NSString *objId = [NSString stringWithFormat: @"%@.title", name]; + + attr = [NSXMLNode attributeWithName: @"ib:key-path-category" + stringValue: @"string"]; + [transunit addAttribute: attr]; + attr = [NSXMLNode attributeWithName: @"ib:key-path" stringValue: @"title"]; + [transunit addAttribute: attr]; + attr = [NSXMLNode attributeWithName: @"id" stringValue: objId]; + [transunit addAttribute: attr]; + [group addChild: transunit]; + + NSXMLElement *source = [NSXMLNode elementWithName: @"source"]; + [source setStringValue: title]; + [transunit addChild: source]; + } } // For each different class, recurse through the structure as needed. - if ([obj isKindOfClass: [NSMenu class]]) + if ([obj isKindOfClass: [NSMenu class]] || + [obj isKindOfClass: [NSPopUpButton class]]) { NSArray *items = [obj itemArray]; NSEnumerator *en = [items objectEnumerator];