diff options
author | lat9nq <22451773+lat9nq@users.noreply.github.com> | 2021-04-05 00:38:49 +0200 |
---|---|---|
committer | lat9nq <22451773+lat9nq@users.noreply.github.com> | 2021-04-05 22:40:03 +0200 |
commit | 2cc42e40c535470e1e290cbb24346d0d68f57f18 (patch) | |
tree | 1a33fac26c4a7fe74d6eaa6b88b81012f6777040 | |
parent | Merge pull request #6139 from Morph1984/cmake-fix-build (diff) | |
download | yuzu-2cc42e40c535470e1e290cbb24346d0d68f57f18.tar yuzu-2cc42e40c535470e1e290cbb24346d0d68f57f18.tar.gz yuzu-2cc42e40c535470e1e290cbb24346d0d68f57f18.tar.bz2 yuzu-2cc42e40c535470e1e290cbb24346d0d68f57f18.tar.lz yuzu-2cc42e40c535470e1e290cbb24346d0d68f57f18.tar.xz yuzu-2cc42e40c535470e1e290cbb24346d0d68f57f18.tar.zst yuzu-2cc42e40c535470e1e290cbb24346d0d68f57f18.zip |
-rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp index 4898dc27a..c2f152190 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp @@ -23,17 +23,22 @@ namespace { template <typename T> std::size_t SpliceVectors(const std::vector<u8>& input, std::vector<T>& dst, std::size_t count, std::size_t offset) { - std::memcpy(dst.data(), input.data() + offset, count * sizeof(T)); - offset += count * sizeof(T); - return offset; + if (!dst.empty()) { + std::memcpy(dst.data(), input.data() + offset, count * sizeof(T)); + } + return 0; } // Write vectors will write data to the output buffer template <typename T> std::size_t WriteVectors(std::vector<u8>& dst, const std::vector<T>& src, std::size_t offset) { - std::memcpy(dst.data() + offset, src.data(), src.size() * sizeof(T)); - offset += src.size() * sizeof(T); - return offset; + if (src.empty()) { + return 0; + } else { + std::memcpy(dst.data() + offset, src.data(), src.size() * sizeof(T)); + offset += src.size() * sizeof(T); + return offset; + } } } // Anonymous namespace |