Add null checks for color processing functions
This commit is contained in:
@@ -97,6 +97,10 @@ ColorProcessor::ColorProcessor(OCIO::ConstProcessorRcPtr processor)
|
||||
|
||||
void ColorProcessor::ConvertFrame(Frame *f)
|
||||
{
|
||||
if (!cpu_processor_) {
|
||||
return;
|
||||
}
|
||||
|
||||
OCIO::BitDepth ocio_bit_depth =
|
||||
OCIOUtils::GetOCIOBitDepthFromPixelFormat(f->format());
|
||||
|
||||
@@ -115,6 +119,10 @@ void ColorProcessor::ConvertFrame(Frame *f)
|
||||
|
||||
Color ColorProcessor::ConvertColor(const Color &in)
|
||||
{
|
||||
if (!cpu_processor_) {
|
||||
return in;
|
||||
}
|
||||
|
||||
// I've been bamboozled
|
||||
float c[4] = { float(in.red()), float(in.green()), float(in.blue()),
|
||||
float(in.alpha()) };
|
||||
|
||||
@@ -1107,7 +1107,11 @@ void ViewerDisplayWidget::EmitColorAtCursor(QMouseEvent *e)
|
||||
|
||||
reference =
|
||||
renderer()->GetPixelFromTexture(texture_.get(), pixel_pos);
|
||||
display = color_service()->ConvertColor(reference);
|
||||
if (color_service()) {
|
||||
display = color_service()->ConvertColor(reference);
|
||||
} else {
|
||||
display = reference;
|
||||
}
|
||||
}
|
||||
|
||||
emit CursorColor(reference, display);
|
||||
|
||||
Reference in New Issue
Block a user