Bug 421076 - Identical expressions in KoToolBase.cpp
Summary: Identical expressions in KoToolBase.cpp
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: General (other bugs)
Version First Reported In: git master (please specify the git hash!)
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-05 20:12 UTC by Rafał Mikrut
Modified: 2020-05-06 01:03 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rafał Mikrut 2020-05-05 20:12:06 UTC
```
if (d->canvas && d->canvas->canvasController() && d->canvas->canvasController()) {
```

https://invent.kde.org/kde/krita/-/blob/master/libs/flake/KoToolBase.cpp#L189
Comment 1 Tiar 2020-05-06 01:03:15 UTC
Git commit c2ffbc6b19ac966b231cc8edea13533ac56a310c by Agata Cacko.
Committed on 05/05/2020 at 22:48.
Pushed by tymond into branch 'master'.

Move asserts before usage of a variable

Before this commit, there were two asserts that were checked
only after both of the variables were used. This means that instead of
asserting, Krita would crash. It probaby doesn't change much in case of
Q_ASSERTs (it would be different with asserts that allows recovering)
but nonetheless, it makes no sense to assert after using a variable.
This commit moves the asserts above the usage.

M  +2    -2    libs/pigment/KoColorConversionSystem.cpp

https://invent.kde.org/kde/krita/commit/c2ffbc6b19ac966b231cc8edea13533ac56a310c