From 3ec90dc6ef529590112eabc6df412fe18a085aab Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 24 Oct 2018 15:03:29 -0400 Subject: [PATCH] service/acc: Early return in failure case in LoadImage() Allows unindenting the other branch's code. --- src/core/hle/service/acc/acc.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index cf065c2e01..17e3aa0e2a 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -104,20 +104,20 @@ private: rb.Push(RESULT_SUCCESS); const FileUtil::IOFile image(GetImagePath(user_id), "rb"); - if (!image.IsOpen()) { LOG_WARNING(Service_ACC, "Failed to load user provided image! Falling back to built-in backup..."); ctx.WriteBuffer(backup_jpeg); rb.Push(backup_jpeg_size); - } else { - const auto size = std::min(image.GetSize(), MAX_JPEG_IMAGE_SIZE); - std::vector buffer(size); - image.ReadBytes(buffer.data(), buffer.size()); - - ctx.WriteBuffer(buffer.data(), buffer.size()); - rb.Push(buffer.size()); + return; } + + const auto size = std::min(image.GetSize(), MAX_JPEG_IMAGE_SIZE); + std::vector buffer(size); + image.ReadBytes(buffer.data(), buffer.size()); + + ctx.WriteBuffer(buffer.data(), buffer.size()); + rb.Push(buffer.size()); } void GetImageSize(Kernel::HLERequestContext& ctx) {