From 9fd3814abe188c13cb0a54e930b5a186817f3f65 Mon Sep 17 00:00:00 2001 From: Pierre Berger Date: Thu, 19 Aug 2021 20:13:00 +0200 Subject: [PATCH] fix app crashing when Skaping livecam is video --- LivecamWallpaper.xcodeproj/project.pbxproj | 8 ++++---- LivecamWallpaper/Controllers/SkapingController.swift | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/LivecamWallpaper.xcodeproj/project.pbxproj b/LivecamWallpaper.xcodeproj/project.pbxproj index d4e503d..69fdda0 100644 --- a/LivecamWallpaper.xcodeproj/project.pbxproj +++ b/LivecamWallpaper.xcodeproj/project.pbxproj @@ -422,7 +422,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_ASSET_PATHS = "\"LivecamWallpaper/Preview Content\""; DEVELOPMENT_TEAM = ""; ENABLE_HARDENED_RUNTIME = YES; @@ -433,7 +433,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 0.2.0; + MARKETING_VERSION = 0.2.1; PRODUCT_BUNDLE_IDENTIFIER = fr.pierreberger.LivecamWallpaper; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -451,7 +451,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_ASSET_PATHS = "\"LivecamWallpaper/Preview Content\""; DEVELOPMENT_TEAM = ""; ENABLE_HARDENED_RUNTIME = YES; @@ -462,7 +462,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 0.2.0; + MARKETING_VERSION = 0.2.1; PRODUCT_BUNDLE_IDENTIFIER = fr.pierreberger.LivecamWallpaper; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/LivecamWallpaper/Controllers/SkapingController.swift b/LivecamWallpaper/Controllers/SkapingController.swift index 461280e..3146e56 100644 --- a/LivecamWallpaper/Controllers/SkapingController.swift +++ b/LivecamWallpaper/Controllers/SkapingController.swift @@ -72,6 +72,11 @@ final class SkapingController { return } + if response.medias.count == 0 { + completion("No media for this livecam") + return + } + DispatchQueue.main.async { let image = response.medias[response.medias.count - 1].src let secureimage = image.replacingOccurrences(of: "http", with: "https")