diff --git a/src/bin/mdbook.rs b/src/bin/mdbook.rs index 78387ba1..416aa081 100644 --- a/src/bin/mdbook.rs +++ b/src/bin/mdbook.rs @@ -358,7 +358,10 @@ fn trigger_on_change(book: &mut MDBook, closure: F) -> () }; // Add the theme directory to the watcher - watcher.watch(book.get_theme_path(), Recursive).unwrap_or_default(); + if let Some(t) = book.get_theme_path() { + watcher.watch(t, Recursive).unwrap_or_default(); + } + // Add the book.{json,toml} file to the watcher if it exists, because it's not // located in the source directory