linker: More null check

This commit is contained in:
IndecisiveTurtle 2024-06-26 18:04:28 +03:00
parent 4846704832
commit 3a80df007e
2 changed files with 13 additions and 5 deletions

View File

@ -68,8 +68,10 @@ void Linker::Execute() {
}
// Configure used flexible memory size.
if (u64* flexible_size = GetProcParam()->mem_param->flexible_memory_size) {
memory->SetTotalFlexibleSize(*flexible_size);
if (auto* mem_param = GetProcParam()->mem_param) {
if (u64* flexible_size = mem_param->flexible_memory_size) {
memory->SetTotalFlexibleSize(*flexible_size);
}
}
// Init primary thread.

View File

@ -206,9 +206,15 @@ int MemoryManager::QueryProtection(VAddr addr, void** start, void** end, u32* pr
const auto& vma = it->second;
ASSERT_MSG(vma.type != VMAType::Free, "Provided address is not mapped");
*start = reinterpret_cast<void*>(vma.base);
*end = reinterpret_cast<void*>(vma.base + vma.size);
*prot = static_cast<u32>(vma.prot);
if (start != nullptr) {
*start = reinterpret_cast<void*>(vma.base);
}
if (end != nullptr) {
*end = reinterpret_cast<void*>(vma.base + vma.size);
}
if (prot != nullptr) {
*prot = static_cast<u32>(vma.prot);
}
return ORBIS_OK;
}