You've already forked AstralRinth
forked from didirus/AstralRinth
Fix panic on requesting projects (#223)
This commit is contained in:
@@ -650,14 +650,20 @@ impl Project {
|
||||
.split(" ,")
|
||||
.map(|d| {
|
||||
let strings: Vec<&str> = d.split(", ").collect();
|
||||
DonationUrl {
|
||||
project_id: id,
|
||||
platform_id: DonationPlatformId(strings[0].parse().unwrap_or(0)),
|
||||
platform_short: strings[2].to_string(),
|
||||
platform_name: strings[3].to_string(),
|
||||
url: strings[1].to_string(),
|
||||
|
||||
if strings.len() >= 3 {
|
||||
Some(DonationUrl {
|
||||
project_id: id,
|
||||
platform_id: DonationPlatformId(strings[0].parse().unwrap_or(0)),
|
||||
platform_short: strings[2].to_string(),
|
||||
platform_name: strings[3].to_string(),
|
||||
url: strings[1].to_string(),
|
||||
})
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.flatten()
|
||||
.collect(),
|
||||
gallery_items: m
|
||||
.gallery
|
||||
@@ -755,14 +761,20 @@ impl Project {
|
||||
.split(" ,")
|
||||
.map(|d| {
|
||||
let strings: Vec<&str> = d.split(", ").collect();
|
||||
DonationUrl {
|
||||
project_id: ProjectId(id),
|
||||
platform_id: DonationPlatformId(strings[0].parse().unwrap_or(0)),
|
||||
platform_short: strings[2].to_string(),
|
||||
platform_name: strings[3].to_string(),
|
||||
url: strings[1].to_string(),
|
||||
|
||||
if strings.len() >= 3 {
|
||||
Some(DonationUrl {
|
||||
project_id: ProjectId(id),
|
||||
platform_id: DonationPlatformId(strings[0].parse().unwrap_or(0)),
|
||||
platform_short: strings[2].to_string(),
|
||||
platform_name: strings[3].to_string(),
|
||||
url: strings[1].to_string(),
|
||||
})
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.flatten()
|
||||
.collect(),
|
||||
gallery_items: m.gallery.iter().map(|x| GalleryItem {
|
||||
project_id: ProjectId(id),
|
||||
|
||||
Reference in New Issue
Block a user