From 7bd2aa41414736f6451241725778509fe75860b5 Mon Sep 17 00:00:00 2001 From: ibireme Date: Sun, 6 Aug 2017 22:57:33 +0800 Subject: [PATCH] Fix Xcode warnings --- YYText/Component/YYTextLayout.m | 6 +++--- YYText/String/YYTextAttribute.m | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/YYText/Component/YYTextLayout.m b/YYText/Component/YYTextLayout.m index 808b55fc..708ba1dd 100644 --- a/YYText/Component/YYTextLayout.m +++ b/YYText/Component/YYTextLayout.m @@ -2251,7 +2251,7 @@ static void YYTextDrawRun(YYTextLine *line, CTRunRef run, CGContextRef context, CGContextSaveGState(context); { CGContextSetFillColorWithColor(context, fillColor); - if (!strokeWidth || strokeWidth.floatValue == 0) { + if (strokeWidth == nil || strokeWidth.floatValue == 0) { CGContextSetTextDrawingMode(context, kCGTextFill); } else { CGColorRef strokeColor = (CGColorRef)CFDictionaryGetValue(runAttrs, kCTStrokeColorAttributeName); @@ -2901,7 +2901,7 @@ static void YYTextDrawDecoration(YYTextLayout *layout, CGContextRef context, CGS color = (__bridge CGColorRef)(attrs[(id)kCTForegroundColorAttributeName]); color = YYTextGetCGColor(color); } - CGFloat thickness = underline.width ? underline.width.floatValue : lineThickness; + CGFloat thickness = (underline.width != nil) ? underline.width.floatValue : lineThickness; YYTextShadow *shadow = underline.shadow; while (shadow) { if (!shadow.color) { @@ -2930,7 +2930,7 @@ static void YYTextDrawDecoration(YYTextLayout *layout, CGContextRef context, CGS color = (__bridge CGColorRef)(attrs[(id)kCTForegroundColorAttributeName]); color = YYTextGetCGColor(color); } - CGFloat thickness = strikethrough.width ? strikethrough.width.floatValue : lineThickness; + CGFloat thickness = (strikethrough.width != nil) ? strikethrough.width.floatValue : lineThickness; YYTextShadow *shadow = underline.shadow; while (shadow) { if (!shadow.color) { diff --git a/YYText/String/YYTextAttribute.m b/YYText/String/YYTextAttribute.m index 09fa05f7..e79517b6 100644 --- a/YYText/String/YYTextAttribute.m +++ b/YYText/String/YYTextAttribute.m @@ -113,7 +113,7 @@ YYTextAttributeType YYTextAttributeGetType(NSString *name){ dic[YYTextGlyphTransformAttributeName] = YYText; }); NSNumber *num = dic[name]; - if (num) return num.integerValue; + if (num != nil) return num.integerValue; return YYTextAttributeTypeNone; }