fix:Check image map nullptr error

The map may be failed, we should check the image map is succeed first.

Signed-off-by: luochaojiang <luochaojiang@uniontech.com>
This commit is contained in:
Chaojiang Luo 2020-07-10 10:30:24 +08:00
parent 901a9a2373
commit def9817a7e

View file

@ -65,8 +65,9 @@ void DrmQPainterBackend::initOutput(DrmOutput *output)
Output o;
auto initBuffer = [&o, output, this] (int index) {
o.buffer[index] = m_backend->createBuffer(output->pixelSize());
o.buffer[index]->map();
o.buffer[index]->image()->fill(Qt::black);
if (o.buffer[index]->map()) {
o.buffer[index]->image()->fill(Qt::black);
}
};
connect(output, &DrmOutput::modeChanged, this,
[output, this] {
@ -82,8 +83,9 @@ void DrmQPainterBackend::initOutput(DrmOutput *output)
delete (*it).buffer[1];
auto initBuffer = [it, output, this] (int index) {
it->buffer[index] = m_backend->createBuffer(output->pixelSize());
it->buffer[index]->map();
it->buffer[index]->image()->fill(Qt::black);
if (o.buffer[index]->map()) {
it->buffer[index]->image()->fill(Qt::black);
}
};
initBuffer(0);
initBuffer(1);