theyakka / qr.flutter

QR.Flutter is a Flutter library for simple and fast QR code rendering via a Widget or custom painter.
https://pub.dev/packages/qr_flutter
BSD 3-Clause "New" or "Revised" License
718 stars 323 forks source link

qr_painter.dart, Null check operator used on a null value #223

Open masterwok opened 2 months ago

masterwok commented 2 months ago

Describe the bug

Version: 4.1.0

Observing the following stack-trace in production DataDog logs:

#0 replaceFirstNull (/Users/vagrant/.pub-cache/hosted/pub.dev/source_span-1.10.0/lib/src/utils.dart:39)
#0 Highlighter.highlight (/Users/vagrant/.pub-cache/hosted/pub.dev/source_span-1.10.0/lib/src/highlighter.dart:224)
#1 QrPainter._initPaints (/Users/vagrant/.pub-cache/hosted/pub.dev/qr_flutter-4.1.0/lib/src/qr_painter.dart:183)

To Reproduce Steps to reproduce the behavior:

Haven't been able to reproduce this issue locally.

Expected behavior

Should guard against null reference exception.

Screenshots

n/a

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context

n/a

masterwok commented 2 months ago

I believe the line numbers from the trace above aren't accurate and the issue is occuring here:

https://github.com/theyakka/qr.flutter/blob/d5e7206396105d643113618290bbcc755d05f492/lib/src/qr_painter.dart#L148