Prechádzať zdrojové kódy

Add assert in label'font property (#1415)

 add assert in MJ_Label attributes
Kinarobin 5 rokov pred
rodič
commit
8076403105
1 zmenil súbory, kde vykonal 1 pridanie a 0 odobranie
  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}