Add null checks for color processing functions

This commit is contained in:
孙羽
2026-05-28 18:21:42 +08:00
parent 116a4b8368
commit 00f57533e6
3 changed files with 13 additions and 15 deletions
+8
View File
@@ -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()) };
+5 -1
View File
@@ -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);