diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp
index 74626fbc863..a3f6cc2f11c 100644
--- a/src/plugins/debugger/breakhandler.cpp
+++ b/src/plugins/debugger/breakhandler.cpp
@@ -1940,10 +1940,13 @@ QString BreakpointItem::toolTip() const
<< "
" << Tr::tr("Marker File:")
<< " | " << markerFileName().toUserOutput() << " |
"
<< "" << Tr::tr("Marker Line:")
- << " | " << markerLineNumber() << " |
"
- << "" << Tr::tr("Hit Count:")
- << " | " << m_parameters.hitCount << " |
"
- << "
"
+ << "" << markerLineNumber() << " | ";
+ if (m_parameters.hitCount) {
+ str << "" << Tr::tr("Hit Count:")
+ << " | " << *m_parameters.hitCount << " |
";
+ }
+
+ str << "
"
<< "" << Tr::tr("Property")
<< " | " << Tr::tr("Requested")
<< " | " << Tr::tr("Obtained") << " |
";
diff --git a/src/plugins/debugger/breakpoint.cpp b/src/plugins/debugger/breakpoint.cpp
index 2fe9b2da368..4faf6a8a668 100644
--- a/src/plugins/debugger/breakpoint.cpp
+++ b/src/plugins/debugger/breakpoint.cpp
@@ -207,7 +207,8 @@ QString BreakpointParameters::toString() const
ts << " [pending]";
if (!functionName.isEmpty())
ts << " Function: " << functionName;
- ts << " Hit: " << hitCount << " times";
+ if (hitCount)
+ ts << " Hit: " << *hitCount << " times";
ts << ' ';
return result;
diff --git a/src/plugins/debugger/breakpoint.h b/src/plugins/debugger/breakpoint.h
index af96f43d055..4366139330b 100644
--- a/src/plugins/debugger/breakpoint.h
+++ b/src/plugins/debugger/breakpoint.h
@@ -155,7 +155,7 @@ public:
bool oneShot; //!< Should this breakpoint trigger only once?
bool pending = true; //!< Breakpoint not fully resolved.
- int hitCount = 0; //!< Number of times this has been hit.
+ std::optional hitCount; //!< Number of times this has been hit.
};
} // namespace Internal