Showing the changes to Source/Libraries/GSF.Core/Parsing/MultiSourceFrameImageParserBase.cs (1 of 1 file). Show all
Unified · Split
| @@ -378,16 +378,19 @@ namespace GSF.Parsing · 377 unmodified lines | ||
| 378 | 378 | |
| 379 | 379 | try |
| 380 | 380 | { |
| 381 | − // Get an identifiable buffer object | |
| 382 | − identifiableBuffer = ReusableObjectPool<SourceIdentifiableBuffer>.Default.TakeObject(); | |
| 383 | − identifiableBuffer.Source = source; | |
| 384 | − identifiableBuffer.Count = count; | |
| 381 | + if (count > 0) | |
| 382 | + { | |
| 383 | + // Get an identifiable buffer object | |
| 384 | + identifiableBuffer = ReusableObjectPool<SourceIdentifiableBuffer>.Default.TakeObject(); | |
| 385 | + identifiableBuffer.Source = source; | |
| 386 | + identifiableBuffer.Count = count; | |
| 385 | 387 | |
| 386 | − // Copy buffer data for processing (destination buffer preallocated from buffer pool) | |
| 387 | − Buffer.BlockCopy(buffer, offset, identifiableBuffer.Buffer, 0, count); | |
| 388 | + // Copy buffer data for processing (destination buffer preallocated from buffer pool) | |
| 389 | + Buffer.BlockCopy(buffer, offset, identifiableBuffer.Buffer, 0, count); | |
| 388 | 390 | |
| 389 | − // Add buffer to the queue for parsing | |
| 390 | − m_bufferQueue.Add(identifiableBuffer); | |
| 391 | + // Add buffer to the queue for parsing | |
| 392 | + m_bufferQueue.Add(identifiableBuffer); | |
| 393 | + } | |
| 391 | 394 | } |
| 392 | 395 | catch |
| 393 | 396 | { |