github / github/codeql

LGTM.com - false positive - unnecessary null check C#

Đang mở
#6,554 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
acknowledged C# false-positive not security
Ngôn ngữ chính
CodeQL
Star
10.1k
Fork
2.1k
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
141

Mô tả

Found it in a **.NET 5.0 C#** project of mine, an access to a **List\** object in a loop had a warning saying it may be null because of some checks.

This shouldn't be the case because the loop is already limited by a variable **n** which gets **0** in the case of the object being null, or the length of the object. When the **n** variable is **0** loop is skipped, therefore the null check inside it is unnecessary.

[**>>Alert link here<<**](https://lgtm.com/projects/g/semihM/exmat/snapshot/094b2dcf4a99b7e555bdb418d990a04b9344df98/files/exmatstdlib/ExStdString.cs?sort=name&dir=ASC&mode=heatmap#xf95a12ccdeb2d93c:1)

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.