1
0
Fork 0
mirror of synced 2024-04-25 16:22:07 +12:00

Fix crash with 0 checked images

This commit is contained in:
Rafał Mikrut 2022-07-09 19:18:26 +02:00
parent e3cea67634
commit 07cfc7884f
3 changed files with 24 additions and 1 deletions

5
.gitignore vendored
View file

@ -9,4 +9,7 @@ TestSuite*
flatpak/
*.zip
*.zst
*.profraw
*.profraw
*.profdata
/lcov_report*
/report

View file

@ -673,6 +673,10 @@ impl SimilarImages {
}
fn find_similar_hashes(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&futures::channel::mpsc::UnboundedSender<ProgressData>>) -> bool {
if self.image_hashes.is_empty() {
return true;
}
let hash_map_modification = SystemTime::now();
let tolerance = self.similarity;

View file

@ -277,3 +277,19 @@ It works in this way:
In `Proper Extension` column, inside parentheses is visible extension guessed by Infer library, and outside there are extensions which have same mime type as guessed one.
![ABC](https://user-images.githubusercontent.com/41945903/167214811-7d811829-6dba-4da0-9788-9e2f780e7279.png)
## Code coverage
If you want to check code coverage of Czkawka(both in tests or in normal usage) you can execute this simple commands(supports Ubuntu 22.04, but for other OS only installation instruction of packages should be different).
```commandline
sudo apt install llvm
cargo install rustfilt
RUSTFLAGS="-C instrument-coverage" cargo run --bin czkawka_gui
llvm-profdata merge -sparse default.profraw -o default.profdata
llvm-cov show -Xdemangler=rustfilt target/debug/czkawka_gui -format=html -output-dir=report -instr-profile=default.profdata -ignore-filename-regex="cargo/registry|rustc"
llvm-cov report -Xdemangler=rustfilt target/debug/czkawka_gui --instr-profile=default.profdata -ignore-filename-regex="cargo/registry" > lcov_report.txt
xdg-open report/index.html
xdg-open lcov_report.txt
```