bpm: Fix potential null-pointer dereference

`update_metrics()` in `bpm.c` is checking for null pointer arguments,
and there was a very minor chance of dereferencing a null-pointer in
the logged message. Correct the logic to prevent this from happening.
This commit is contained in:
Alex Luccisano
2025-01-31 14:12:59 -05:00
committed by Ryan Foster
parent 80ea1b14fb
commit 64cb68af56
+6 -1
View File
@@ -16,7 +16,12 @@ static void render_metrics_time(struct metrics_time *m_time)
static bool update_metrics(obs_output_t *output, const struct encoder_packet *pkt,
const struct encoder_packet_time *ept, struct metrics_data *m_track)
{
if (!output || !pkt || !ept || !m_track) {
if (!pkt) {
blog(LOG_DEBUG, "%s: Null encoder_packet pointer", __FUNCTION__);
return false;
}
if (!output || !ept || !m_track) {
blog(LOG_DEBUG, "%s: Null arguments for track %lu", __FUNCTION__, pkt->track_idx);
return false;
}