mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
Decoders failing to allocate their buffer will cause a Lua error instead of crashing.
This commit is contained in:
@@ -39,7 +39,14 @@ Decoder::Decoder(Stream *stream, int bufferSize)
|
||||
if (!stream->isReadable() || !stream->isSeekable())
|
||||
throw love::Exception("Decoder input stream must be readable and seekable.");
|
||||
|
||||
buffer = new char[bufferSize];
|
||||
try
|
||||
{
|
||||
buffer = new char[bufferSize];
|
||||
}
|
||||
catch (std::exception &)
|
||||
{
|
||||
throw love::Exception("Out of memory.");
|
||||
}
|
||||
}
|
||||
|
||||
Decoder::~Decoder()
|
||||
|
||||
Reference in New Issue
Block a user