mirror of
				https://github.com/Dummi26/musicdb.git
				synced 2025-10-30 03:25:26 +01:00 
			
		
		
		
	fix bad order implementation causing panic
This commit is contained in:
		
							parent
							
								
									4549a8d360
								
							
						
					
					
						commit
						14660b6dae
					
				| @ -107,16 +107,18 @@ fn main() { | |||||||
|     let mut prev_perc = 999; |     let mut prev_perc = 999; | ||||||
|     songs.sort_by(|(path1, _, tags1), (path2, _, tags2)| { |     songs.sort_by(|(path1, _, tags1), (path2, _, tags2)| { | ||||||
|         // Sort by Disc->Track->Path
 |         // Sort by Disc->Track->Path
 | ||||||
|         if let (Some(d1), Some(d2)) = (tags1.disc(), tags2.disc()) { |         match (tags1.disc(), tags2.disc()) { | ||||||
|             d1.cmp(&d2) |             (Some(d1), Some(d2)) => d1.cmp(&d2), | ||||||
|         } else { |             (Some(_), None) => Ordering::Greater, | ||||||
|             Ordering::Equal |             (None, Some(_)) => Ordering::Less, | ||||||
|  |             (None, None) => Ordering::Equal, | ||||||
|         } |         } | ||||||
|         .then_with(|| { |         .then_with(|| { | ||||||
|             if let (Some(t1), Some(t2)) = (tags1.track(), tags2.track()) { |             match (tags1.track(), tags2.track()) { | ||||||
|                 t1.cmp(&t2) |                 (Some(t1), Some(t2)) => t1.cmp(&t2), | ||||||
|             } else { |                 (Some(_), None) => Ordering::Greater, | ||||||
|                 Ordering::Equal |                 (None, Some(_)) => Ordering::Less, | ||||||
|  |                 (None, None) => Ordering::Equal, | ||||||
|             } |             } | ||||||
|             .then_with(|| path1.cmp(&path2)) |             .then_with(|| path1.cmp(&path2)) | ||||||
|         }) |         }) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Mark
						Mark