Browse Source

Better warning when allocation fails.

David Piuva 4 years ago
parent
commit
5f5da78a85
1 changed files with 3 additions and 0 deletions
  1. 3 0
      Source/DFPSR/api/bufferAPI.cpp

+ 3 - 0
Source/DFPSR/api/bufferAPI.cpp

@@ -78,6 +78,9 @@ BufferImpl::BufferImpl(int64_t newSize) :
   size(newSize),
   bufferSize(roundUp(newSize, buffer_alignment)) {
 	this->data = buffer_allocate(this->bufferSize, this->destructor);
+	if (this->data == nullptr) {
+		throwError(U"Failed to allocate buffer of ", newSize, " bytes!\n");
+	}
 	memset(this->data, 0, this->bufferSize);
 }