Commit 651023e9 by cook Committed by GitHub

fix crash : If title or message is object of NSNull class can make the app crash (#217)

Co-authored-by: 郭智强 <cook.guo@ximalaya.com>
parent 1c9f50bb
......@@ -221,7 +221,7 @@ static const NSString * CSToastQueueKey = @"CSToastQueueKey";
imageRect.size.height = imageView.bounds.size.height;
}
if (title != nil) {
if (title != nil && [title isKindOfClass:[NSString class]]) {
titleLabel = [[UILabel alloc] init];
titleLabel.numberOfLines = style.titleNumberOfLines;
titleLabel.font = style.titleFont;
......@@ -240,7 +240,7 @@ static const NSString * CSToastQueueKey = @"CSToastQueueKey";
titleLabel.frame = CGRectMake(0.0, 0.0, expectedSizeTitle.width, expectedSizeTitle.height);
}
if (message != nil) {
if (message != nil && [message isKindOfClass:[NSString class]]) {
messageLabel = [[UILabel alloc] init];
messageLabel.numberOfLines = style.messageNumberOfLines;
messageLabel.font = style.messageFont;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment