From f609fb944d73cf16aba1b05e8ed8c444804b77b1 Mon Sep 17 00:00:00 2001 From: Grant Paul Date: Fri, 18 Nov 2016 01:52:45 -0800 Subject: [PATCH] Avoid returning a default SDK for a platform with no SDKs. This would crash if a platform name matched, but it had no SDKs. --- Libraries/xcsdk/Sources/SDK/Manager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Libraries/xcsdk/Sources/SDK/Manager.cpp b/Libraries/xcsdk/Sources/SDK/Manager.cpp index 1b63afd7..89480cec 100644 --- a/Libraries/xcsdk/Sources/SDK/Manager.cpp +++ b/Libraries/xcsdk/Sources/SDK/Manager.cpp @@ -47,7 +47,9 @@ findTarget(std::string const &name) const /* If the platform name matches but no targets do, use any target. */ if (platform->name() == name || platform->path() == name) { - return platform->targets().back(); + if (!platform->targets().empty()) { + return platform->targets().back(); + } } }