1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-07 12:00:09 +02:00

🐛 Prevent #61 from crashing the app

This commit is contained in:
2021-12-06 13:24:03 +01:00
parent 7e185154ef
commit e381880675
2 changed files with 14 additions and 7 deletions

View File

@ -762,7 +762,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = "4.1-beta3";
MARKETING_VERSION = "4.1-beta4";
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@ -787,7 +787,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = "4.1-beta3";
MARKETING_VERSION = "4.1-beta4";
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";

View File

@ -11,7 +11,7 @@ import Foundation
class PhpInstallation {
var longVersion: String
var homebrewInfo: HomebrewPackage
var homebrewInfo: HomebrewPackage?
/**
In order to determine details about a PHP installation, well simply run `php-config --version`
@ -29,10 +29,17 @@ class PhpInstallation {
}
let info = Shell.pipe("\(Paths.brew) info php@\(version) --json")
self.homebrewInfo = try! JSONDecoder().decode(
[HomebrewPackage].self,
from: info.data(using: .utf8)!
).first!
do {
self.homebrewInfo = try JSONDecoder().decode(
[HomebrewPackage].self,
from: info.data(using: .utf8)!
).first ?? nil
} catch {
// TODO: Perhaps show a modal to indicate theres an issue with Homebrew?
print("There was an issue parsing Homebrew info for PHP \(version)")
self.homebrewInfo = nil
}
}
}