Skip to content

Commit

Permalink
Block registration of hooks for built-in formats
Browse files Browse the repository at this point in the history
  • Loading branch information
fintelia committed Oct 29, 2024
1 parent 8bf0cf2 commit 97fb13c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ pub type DecodingHook =

/// Register a new decoding hook or returns false if one already exists for the given format.
pub fn register_decoding_hook(format: ImageFormat, hook: DecodingHook) -> bool {
if format.reading_enabled() {
return false;
}

let mut hooks = DECODING_HOOKS.write().unwrap();
if hooks.is_none() {
*hooks = Some(HashMap::new());
Expand Down

0 comments on commit 97fb13c

Please sign in to comment.