Skip to content

Commit

Permalink
Fix the UI version stuff (obhq#862)
Browse files Browse the repository at this point in the history
  • Loading branch information
VocalFan authored May 6, 2024
1 parent fa5ea8e commit 4512e9c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
5 changes: 4 additions & 1 deletion src/core/src/param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,8 @@ pub unsafe extern "C" fn param_title_id_get(param: &Param, buf: &mut QString) {

#[no_mangle]
pub unsafe extern "C" fn param_version_get(param: &Param, buf: &mut QString) {
buf.set(param.version());
match param.version() {
Some(version) => buf.set(version),
None => buf.set(""),
}
}
11 changes: 4 additions & 7 deletions src/param/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub struct Param {
content_id: Box<str>,
title: Option<Box<str>>,
title_id: Box<str>,
version: Box<str>,
version: Option<Box<str>>,
}

impl Param {
Expand Down Expand Up @@ -166,7 +166,7 @@ impl Param {
content_id: content_id.ok_or(ReadError::MissingContentId)?,
title,
title_id: title_id.ok_or(ReadError::MissingTitleId)?,
version: version.ok_or(ReadError::MissingVersion)?,
version: version,
})
}

Expand Down Expand Up @@ -204,8 +204,8 @@ impl Param {
}

/// Fetches the value VERSION from given Param.SFO
pub fn version(&self) -> &str {
&self.version
pub fn version(&self) -> Option<&str> {
self.version.as_deref()
}

fn read_utf8<R: Read>(
Expand Down Expand Up @@ -276,7 +276,4 @@ pub enum ReadError {

#[error("TITLE_ID parameter not found")]
MissingTitleId,

#[error("VERSION parameter not found")]
MissingVersion,
}

0 comments on commit 4512e9c

Please sign in to comment.