From ae3d606e951574070ca7890b14703d9ccf4afc57 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 9 Apr 2015 10:01:31 -0700 Subject: [PATCH] Replace try with nothrow --- libraries/gpu/src/gpu/Resource.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/gpu/src/gpu/Resource.cpp b/libraries/gpu/src/gpu/Resource.cpp index a13a5cc444..708ca0f627 100644 --- a/libraries/gpu/src/gpu/Resource.cpp +++ b/libraries/gpu/src/gpu/Resource.cpp @@ -27,9 +27,9 @@ Resource::Size Resource::Sysmem::allocateMemory(Byte** dataAllocated, Size size) if (size > 0) { // Try allocating as much as the required size + one block of memory newSize = size; - try { - (*dataAllocated) = new Byte[newSize]; - } catch (const std::bad_alloc&) { + (*dataAllocated) = new (std::nothrow) Byte[newSize]; + // Failed? + if (!(*dataAllocated)) { qWarning() << "Buffer::Sysmem::allocate() : Can't allocate a system memory buffer of " << newSize << "bytes. Fails to create the buffer Sysmem."; return NOT_ALLOCATED; }