Commit 63801fc1 authored by Felix Paul Kühne's avatar Felix Paul Kühne

library: fixed crash when create folder through drag & drop of 2 MLFile representations

Side note: don't listen on properties you don't care about
parent 96e66125
...@@ -115,7 +115,6 @@ ...@@ -115,7 +115,6 @@
[_mediaObject removeObserver:self forKeyPath:@"album"]; [_mediaObject removeObserver:self forKeyPath:@"album"];
[_mediaObject removeObserver:self forKeyPath:@"artist"]; [_mediaObject removeObserver:self forKeyPath:@"artist"];
[_mediaObject removeObserver:self forKeyPath:@"genre"]; [_mediaObject removeObserver:self forKeyPath:@"genre"];
[_mediaObject removeObserver:self forKeyPath:@"labels"];
[(MLFile*)_mediaObject didHide]; [(MLFile*)_mediaObject didHide];
} }
...@@ -148,7 +147,6 @@ ...@@ -148,7 +147,6 @@
[_mediaObject addObserver:self forKeyPath:@"album" options:0 context:nil]; [_mediaObject addObserver:self forKeyPath:@"album" options:0 context:nil];
[_mediaObject addObserver:self forKeyPath:@"artist" options:0 context:nil]; [_mediaObject addObserver:self forKeyPath:@"artist" options:0 context:nil];
[_mediaObject addObserver:self forKeyPath:@"genre" options:0 context:nil]; [_mediaObject addObserver:self forKeyPath:@"genre" options:0 context:nil];
[_mediaObject addObserver:self forKeyPath:@"labels" options:0 context:nil];
[(MLFile*)_mediaObject willDisplay]; [(MLFile*)_mediaObject willDisplay];
} }
} }
...@@ -169,7 +167,7 @@ ...@@ -169,7 +167,7 @@
MLLabel *mediaObject = (MLLabel *)self.mediaObject; MLLabel *mediaObject = (MLLabel *)self.mediaObject;
[self _configureForFolder:mediaObject]; [self _configureForFolder:mediaObject];
if ([keyPath isEqualToString:@"files"] || [keyPath isEqualToString:@"labels"] || !keyPath || (!self.thumbnailView.image && [keyPath isEqualToString:@"editing"])) { if ([keyPath isEqualToString:@"files"] || !keyPath || (!self.thumbnailView.image && [keyPath isEqualToString:@"editing"])) {
if (mediaObject.files.count == 0) { if (mediaObject.files.count == 0) {
self.thumbnailView.contentMode = UIViewContentModeScaleAspectFit; self.thumbnailView.contentMode = UIViewContentModeScaleAspectFit;
self.thumbnailView.image = [UIImage imageNamed:@"folderIcon"]; self.thumbnailView.image = [UIImage imageNamed:@"folderIcon"];
......
...@@ -74,7 +74,6 @@ ...@@ -74,7 +74,6 @@
[_mediaObject removeObserver:self forKeyPath:@"album"]; [_mediaObject removeObserver:self forKeyPath:@"album"];
[_mediaObject removeObserver:self forKeyPath:@"artist"]; [_mediaObject removeObserver:self forKeyPath:@"artist"];
[_mediaObject removeObserver:self forKeyPath:@"genre"]; [_mediaObject removeObserver:self forKeyPath:@"genre"];
[_mediaObject removeObserver:self forKeyPath:@"labels"];
[(MLFile*)_mediaObject didHide]; [(MLFile*)_mediaObject didHide];
} }
...@@ -107,7 +106,6 @@ ...@@ -107,7 +106,6 @@
[_mediaObject addObserver:self forKeyPath:@"album" options:0 context:nil]; [_mediaObject addObserver:self forKeyPath:@"album" options:0 context:nil];
[_mediaObject addObserver:self forKeyPath:@"artist" options:0 context:nil]; [_mediaObject addObserver:self forKeyPath:@"artist" options:0 context:nil];
[_mediaObject addObserver:self forKeyPath:@"genre" options:0 context:nil]; [_mediaObject addObserver:self forKeyPath:@"genre" options:0 context:nil];
[_mediaObject addObserver:self forKeyPath:@"labels" options:0 context:nil];
[(MLFile*)_mediaObject willDisplay]; [(MLFile*)_mediaObject willDisplay];
} }
} }
...@@ -146,7 +144,7 @@ ...@@ -146,7 +144,7 @@
MLLabel *mediaObject = (MLLabel *)self.mediaObject; MLLabel *mediaObject = (MLLabel *)self.mediaObject;
[self _configureForFolder:mediaObject]; [self _configureForFolder:mediaObject];
if ([keyPath isEqualToString:@"files"] || [keyPath isEqualToString:@"labels"] || !keyPath || (!self.thumbnailView.image && [keyPath isEqualToString:@"editing"])) { if ([keyPath isEqualToString:@"files"] || !keyPath || (!self.thumbnailView.image && [keyPath isEqualToString:@"editing"])) {
if (mediaObject.files.count == 0) { if (mediaObject.files.count == 0) {
self.thumbnailView.contentMode = UIViewContentModeScaleAspectFit; self.thumbnailView.contentMode = UIViewContentModeScaleAspectFit;
self.thumbnailView.image = [UIImage imageNamed:@"folderIcon"]; self.thumbnailView.image = [UIImage imageNamed:@"folderIcon"];
......
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