Skip to content

Commit 18f35e3

Browse files
committed
Fix: Resolve parameter reassignment issue in Color.divideLocal
- Updated the `divideLocal` method to avoid reassignment of the input parameter `a`. - Ensured proper functionality by using the `this` keyword for color components (r, g, b, a). - Addressed potential confusion and bugs caused by parameter shadowing. Thanks and shout-out to my nerd coding buddy and long-time friend tim for pointing this out—you're a lifesaver!
1 parent 2821352 commit 18f35e3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/main/java/math/Color.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,10 +325,10 @@ public Color subtractLocal(float r, float g, float b, float a) {
325325
* @return this
326326
*/
327327
public Color divideLocal(float a) {
328-
r /= a;
329-
g /= a;
330-
b /= a;
331-
a /= a;
328+
this.r /= a;
329+
this.g /= a;
330+
this.b /= a;
331+
this.a /= a;
332332
return this;
333333
}
334334

0 commit comments

Comments
 (0)