diff options
author | Damiano Galassi <[email protected]> | 2019-06-08 16:20:43 +0200 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2019-06-08 16:20:43 +0200 |
commit | c36996ced365c839b01c5297d799ba79f1e05299 (patch) | |
tree | b584d6a570d36def3f07ef7a4e8f7ae36ac0f64c /macosx/HBQueueItem.m | |
parent | 908b78452f8e53b5a9de3a592949eb30b21a5ec5 (diff) |
MacGui: write the queue to disk less often and add some validations when reading it back from disk.
Diffstat (limited to 'macosx/HBQueueItem.m')
-rw-r--r-- | macosx/HBQueueItem.m | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/macosx/HBQueueItem.m b/macosx/HBQueueItem.m index 095a5dc87..e0806d7e7 100644 --- a/macosx/HBQueueItem.m +++ b/macosx/HBQueueItem.m @@ -77,7 +77,7 @@ static NSString *versionKey = @"HBQueueItemVersion"; - (void)encodeWithCoder:(nonnull NSCoder *)coder { [coder encodeInt:1 forKey:versionKey]; - encodeInt((int)_state); + encodeInt(_state); encodeObject(_job); encodeObject(_uuid); } @@ -88,11 +88,7 @@ static NSString *versionKey = @"HBQueueItemVersion"; if (version == 1 && (self = [super init])) { - decodeInt(_state); - if (_state < HBQueueItemStateReady || _state > HBQueueItemStateFailed) - { - goto fail; - } + decodeInt(_state); if (_state < HBQueueItemStateReady || _state > HBQueueItemStateFailed) { goto fail; } decodeObjectOrFail(_job, HBJob); decodeObjectOrFail(_uuid, NSString); return self; |