diff options
author | Alex Merry <dev@randomguy3.me.uk> | 2013-03-25 16:19:46 +0000 |
---|---|---|
committer | Alex Merry <dev@randomguy3.me.uk> | 2013-03-25 16:19:46 +0000 |
commit | 1b83e14b1f5640881deeb03c1d11df5197746b64 (patch) | |
tree | 15459d01d836db14064f120fdd7a3ab38ef2e421 /tikzit/src/common/ColorRGB.m | |
parent | c0137b33c535eb04f5e7d5628e9a225e226c5b34 (diff) |
Fix issues found by the clang static analyzer
Diffstat (limited to 'tikzit/src/common/ColorRGB.m')
-rw-r--r-- | tikzit/src/common/ColorRGB.m | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/tikzit/src/common/ColorRGB.m b/tikzit/src/common/ColorRGB.m index 74d1c55..c108cfe 100644 --- a/tikzit/src/common/ColorRGB.m +++ b/tikzit/src/common/ColorRGB.m @@ -205,18 +205,22 @@ static NSMapTable *colorHash = nil; } - (id)initWithRed:(unsigned short)r green:(unsigned short)g blue:(unsigned short)b { - [super init]; - red = r; - green = g; - blue = b; + self = [super init]; + if (self) { + red = r; + green = g; + blue = b; + } return self; } - (id)initWithFloatRed:(float)r green:(float)g blue:(float)b { - [super init]; - red = round(r*255.0f); - green = round(g*255.0f); - blue = round(b*255.0f); + self = [super init]; + if (self) { + red = round(r*255.0f); + green = round(g*255.0f); + blue = round(b*255.0f); + } return self; } |