diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 4f6c699a4379..ad526a8be6a2 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -102,6 +102,9 @@ bool isRaw(const PixelFormat &pixFmt)
 	 * The isRaw test might be redundant right now the pipeline handler only
 	 * supports RAW sensors. Leave it in for now, just as a sanity check.
 	 */
+	if (!pixFmt.isValid())
+		return false;
+
 	const PixelFormatInfo &info = PixelFormatInfo::info(pixFmt);
 	if (!info.isValid())
 		return false;
