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:
parent
901a9a2373
commit
def9817a7e
1 changed files with 6 additions and 4 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue