From 03191d515b8474764cc2a34dcc2284fcd158bce6 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sat, 11 Mar 2017 00:17:24 -0800 Subject: [PATCH] Do not crash if Safari's Info.plist can't be read. --- CyteKit/extern.mm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CyteKit/extern.mm b/CyteKit/extern.mm index 42317e1a..cbf37749 100644 --- a/CyteKit/extern.mm +++ b/CyteKit/extern.mm @@ -98,12 +98,14 @@ void CyteInitialize(NSString *agent) { agent = [NSString stringWithFormat:@"%@ CyF/%.2f", agent, kCFCoreFoundationVersionNumber]; - if (RegEx match = RegEx("([0-9]+(\\.[0-9]+)+).*", safari)) - agent = [NSString stringWithFormat:@"Safari/%@ %@", match[1], agent]; + if (safari != nil) + if (RegEx match = RegEx("([0-9]+(\\.[0-9]+)+).*", safari)) + agent = [NSString stringWithFormat:@"Safari/%@ %@", match[1], agent]; if (RegEx match = RegEx("([0-9]+[A-Z][0-9]+[a-z]?).*", System_)) agent = [NSString stringWithFormat:@"Mobile/%@ %@", match[1], agent]; - if (RegEx match = RegEx("([0-9]+(\\.[0-9]+)+).*", product)) - agent = [NSString stringWithFormat:@"Version/%@ %@", match[1], agent]; + if (product != nil) + if (RegEx match = RegEx("([0-9]+(\\.[0-9]+)+).*", product)) + agent = [NSString stringWithFormat:@"Version/%@ %@", match[1], agent]; [CyteWebViewController setApplicationNameForUserAgent:agent]; } -- 2.45.2