Skip to content

Commit c50e1c6

Browse files
committed
Fixed crash when full width title was blank
1 parent 5633ece commit c50e1c6

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

src/netmd/base.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ pub enum Status {
9494
/// The ID of a device, including the name
9595
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord)]
9696
pub struct DeviceId {
97-
vendor_id: u16,
98-
product_id: u16,
99-
name: Option<&'static str>,
97+
pub vendor_id: u16,
98+
pub product_id: u16,
99+
pub name: Option<&'static str>,
100100
}
101101

102102
#[derive(Error, Debug, PartialEq, Eq, PartialOrd, Ord)]

src/netmd/interface.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,9 @@ impl NetMDInterface {
974974

975975
let raw_full_title = self.raw_disc_title(true).await?;
976976

977+
dbg!(&raw_title);
978+
dbg!(&raw_full_title);
979+
977980
let mut full_width_group_list = raw_full_title.split("//");
978981

979982
for (i, group) in group_list.enumerate() {
@@ -997,12 +1000,13 @@ impl NetMDInterface {
9971000

9981001
let full_width_range = half_width_to_full_width_range(&track_range);
9991002

1000-
let full_width_group_name = full_width_group_list
1001-
.find(|n| n.starts_with(&full_width_range))
1002-
.unwrap()
1003-
.split_once(';')
1003+
let full_width_group_name = if let Some(n) = full_width_group_list.find(|n| n.starts_with(&full_width_range)) {
1004+
n.split_once(';')
10041005
.unwrap()
1005-
.1;
1006+
.1
1007+
} else {
1008+
""
1009+
};
10061010

10071011
let mut track_minmax: Vec<&str> = Vec::new();
10081012
if track_range.find('-').is_some() {

src/netmd/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub mod encryption;
77
pub mod interface;
88
mod mappings;
99
mod query_utils;
10-
mod utils;
10+
pub mod utils;
1111

1212
#[doc(inline)]
1313
pub use base::DEVICE_IDS_CROSSUSB;

0 commit comments

Comments
 (0)