Commit def9817a authored by Chaojiang Luo's avatar Chaojiang Luo
Browse files

fix:Check image map nullptr error



The map may be failed, we should check the image map is succeed first.
Signed-off-by: default avatarluochaojiang <luochaojiang@uniontech.com>
parent 901a9a23
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment