Skip to content

Commit 3ac5cb0

Browse files
committed
Fix typo. Check input before printing log.
1 parent a20bc9f commit 3ac5cb0

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

STNetTaskQueue/STNetTaskQueue.m

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
@interface STNetTaskQueue()
1313

14-
@property (nonatomic, strong) NSThread *thred;
14+
@property (nonatomic, strong) NSThread *thread;
1515
@property (nonatomic, strong) NSRecursiveLock *lock;
1616
@property (nonatomic, strong) NSMutableDictionary *taskDelegates; // <NSString, NSHashTable<STNetTaskDelegate>>
1717
@property (nonatomic, strong) NSMutableArray *tasks; // <STNetTask>
@@ -34,9 +34,9 @@ + (instancetype)sharedQueue
3434
- (id)init
3535
{
3636
if (self = [super init]) {
37-
self.thred = [[NSThread alloc] initWithTarget:self selector:@selector(threadEntryPoint) object:nil];
38-
self.thred.name = NSStringFromClass(self.class);
39-
[self.thred start];
37+
self.thread = [[NSThread alloc] initWithTarget:self selector:@selector(threadEntryPoint) object:nil];
38+
self.thread.name = NSStringFromClass(self.class);
39+
[self.thread start];
4040
self.lock = [NSRecursiveLock new];
4141
self.lock.name = [NSString stringWithFormat:@"%@Lock", NSStringFromClass(self.class)];
4242
self.taskDelegates = [NSMutableDictionary new];
@@ -76,7 +76,7 @@ - (void)addTask:(STNetTask *)task
7676
NSAssert(!task.finished && !task.cancelled, @"STNetTask is finished/cancelled, please recreate a net task.");
7777

7878
task.pending = YES;
79-
[self performInThread:self.thred usingBlock:^{
79+
[self performInThread:self.thread usingBlock:^{
8080
[self _addTask:task];
8181
}];
8282
}
@@ -98,7 +98,7 @@ - (void)cancelTask:(STNetTask *)task
9898
return;
9999
}
100100

101-
[self performInThread:self.thred usingBlock:^{
101+
[self performInThread:self.thread usingBlock:^{
102102
[self _cancelTask:task];
103103
}];
104104
}
@@ -143,7 +143,7 @@ - (void)_sendWatingTasks
143143

144144
- (void)task:(STNetTask *)task didResponse:(id)response
145145
{
146-
[self performInThread:self.thred usingBlock:^{
146+
[self performInThread:self.thread usingBlock:^{
147147
[self _task:task didResponse:response];
148148
}];
149149
}
@@ -182,7 +182,7 @@ - (void)_task:(STNetTask *)task didResponse:(id)response
182182

183183
- (void)task:(STNetTask *)task didFailWithError:(NSError *)error
184184
{
185-
[self performInThread:self.thred usingBlock:^{
185+
[self performInThread:self.thread usingBlock:^{
186186
[self _task:task didFailWithError:error];
187187
}];
188188
}

STNetTaskQueue/STNetTaskQueueLog.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ @implementation STNetTaskQueueLog
1212

1313
+ (void)log:(NSString *)content, ...
1414
{
15+
if (!content) {
16+
return;
17+
}
1518
va_list args;
1619
va_start(args, content);
1720
content = [[NSString alloc] initWithFormat:content arguments:args];

0 commit comments

Comments
 (0)