Mercurial > hg > orthanc
comparison Plugins/Samples/GdcmDecoder/GdcmImageDecoder.cpp @ 3351:5069af20932a
Web viewer: Check the return value of gdcm::Bitmap::GetBuffer()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 23 Apr 2019 10:28:37 +0200 |
parents | 4e43e67f8ecf |
children | 94f4a18a79cc |
comparison
equal
deleted
inserted
replaced
3349:ef18ea68a362 | 3351:5069af20932a |
---|---|
369 } | 369 } |
370 | 370 |
371 if (decoded.empty()) | 371 if (decoded.empty()) |
372 { | 372 { |
373 decoded.resize(pimpl_->GetImage().GetBufferLength()); | 373 decoded.resize(pimpl_->GetImage().GetBufferLength()); |
374 pimpl_->GetImage().GetBuffer(&decoded[0]); | 374 if (!pimpl_->GetImage().GetBuffer(&decoded[0])) |
375 { | |
376 throw std::runtime_error("Image not properly decoded to a memory buffer"); | |
377 } | |
375 } | 378 } |
376 | 379 |
377 const void* sourceBuffer = &decoded[0]; | 380 const void* sourceBuffer = &decoded[0]; |
378 | 381 |
379 if (target.GetPitch() == bpp * width && | 382 if (target.GetPitch() == bpp * width && |