浏览代码

Add assert in label'font property (#1415)

 add assert in MJ_Label attributes
Kinarobin 5 年之前
父节点
当前提交
8076403105
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      MJRefresh/Base/MJRefreshComponent.m

+ 1 - 0
MJRefresh/Base/MJRefreshComponent.m

@@ -267,6 +267,7 @@ - (CGFloat)mj_textWidth {
                                                         context:nil].size.width;
     } else {
         if (self.text.length == 0) { return 0; }
+        NSAssert(self.font != nil, @"请检查 mj_label's `font` 是否设置正确");
         stringWidth = [self.text boundingRectWithSize:size
                                               options:NSStringDrawingUsesLineFragmentOrigin
                                            attributes:@{NSFontAttributeName:self.font}