1 parent 7ead60f commit 2aa8fa3Copy full SHA for 2aa8fa3
1 file changed
src/TagEdit.pas
@@ -616,8 +616,9 @@ function TTagEdit.RandTagColor(const TagName: string; BrightnessPercent: integer
616
617
// Generate stable hash (FNV-1a)
618
Hash := 2166136267;
619
- for i := 1 to Length(TagName) do
620
- Hash := (Hash xor Ord(TagName[i])) * 16777619;
+ if TagName <> string.Empty then
+ for i := 1 to Length(TagName) do
621
+ Hash := longword(uint64(Hash xor Ord(TagName[i])) * 16777619);
622
623
// Extract RGB components from hash
624
R := (Hash and $FF);
0 commit comments