Skip to content

Commit

Permalink
MacGui: make HBCore titles ivar always non null.
Browse files Browse the repository at this point in the history
  • Loading branch information
galad87 committed Feb 26, 2016
1 parent e06ab1d commit c3c1f6b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion macosx/HBCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ typedef void (^HBCoreCompletionHandler)(HBCoreResult result);
/**
* An array of HBTitles found by the latest scan.
*/
@property (nonatomic, readonly, nullable) NSArray<HBTitle *> *titles;
@property (nonatomic, readonly, copy) NSArray<HBTitle *> *titles;

/**
* This function converts an image created by libhb (specified via index)
Expand Down
6 changes: 4 additions & 2 deletions macosx/HBCore.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ @interface HBCore ()
@property (nonatomic, readonly) dispatch_queue_t updateTimerQueue;

/// Current scanned titles.
@property (nonatomic, readwrite, strong) NSArray<HBTitle *> *titles;
@property (nonatomic, readwrite, copy) NSArray<HBTitle *> *titles;

/// Progress handler.
@property (nonatomic, readwrite, copy) HBCoreProgressHandler progressHandler;
Expand Down Expand Up @@ -96,6 +96,8 @@ - (instancetype)initWithLogLevel:(int)level
_name = @"HBCore";
_state = HBStateIdle;
_updateTimerQueue = dispatch_queue_create("fr.handbrake.coreQueue", DISPATCH_QUEUE_SERIAL);
_titles = @[];

_hb_state = malloc(sizeof(struct hb_state_s));
_logLevel = level;

Expand Down Expand Up @@ -197,7 +199,7 @@ - (void)scanURL:(NSURL *)url titleIndex:(NSUInteger)index previews:(NSUInteger)p
NSAssert(url, @"[HBCore scanURL:] called with nil url.");

// Reset the titles array
self.titles = nil;
self.titles = @[];

// Copy the progress/completion blocks
self.progressHandler = progressHandler;
Expand Down

0 comments on commit c3c1f6b

Please sign in to comment.