Skip to content

Commit

Permalink
Merge pull request #3267 from JosJuice/0-byte-copytoemu
Browse files Browse the repository at this point in the history
Do nothing when calling CopyToEmu with a length of 0
  • Loading branch information
delroth committed Nov 17, 2015
2 parents 24c7d23 + 2005409 commit fb87de8
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Source/Core/Core/HW/Memmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@ static inline bool ValidCopyRange(u32 address, size_t size)

void CopyFromEmu(void* data, u32 address, size_t size)
{
if (size == 0)
return;

if (!ValidCopyRange(address, size))
{
PanicAlert("Invalid range in CopyFromEmu. %zx bytes from 0x%08x", size, address);
Expand All @@ -263,6 +266,9 @@ void CopyFromEmu(void* data, u32 address, size_t size)

void CopyToEmu(u32 address, const void* data, size_t size)
{
if (size == 0)
return;

if (!ValidCopyRange(address, size))
{
PanicAlert("Invalid range in CopyToEmu. %zx bytes to 0x%08x", size, address);
Expand All @@ -273,11 +279,12 @@ void CopyToEmu(u32 address, const void* data, size_t size)

void Memset(const u32 _Address, const u8 _iValue, const u32 _iLength)
{
if (_iLength == 0)
return;

u8* ptr = GetPointer(_Address);
if (ptr != nullptr)
{
memset(ptr,_iValue,_iLength);
}
memset(ptr, _iValue, _iLength);
}

std::string GetString(u32 em_address, size_t size)
Expand Down

0 comments on commit fb87de8

Please sign in to comment.