diff options
| author | Simon Johnsson <simon.johnsson@canonical.com> | 2025-10-06 23:15:50 +0200 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2025-10-06 21:15:50 +0000 |
| commit | bcc245651becca2ce226589e76a7c7f0177e40a5 (patch) | |
| tree | 99b2772ca705f904d0b8dd860e3083231fc1dca9 | |
| parent | 0d083dd1eed93bfbca712f00c02de61b53acaf96 (diff) | |
Fix history command error when no ID was given
| -rw-r--r-- | apt-private/private-history.cc | 2 | ||||
| -rwxr-xr-x | test/integration/test-history | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/apt-private/private-history.cc b/apt-private/private-history.cc index cf4540772..31b3b1333 100644 --- a/apt-private/private-history.cc +++ b/apt-private/private-history.cc @@ -352,6 +352,8 @@ class TransactionController static bool ParseId(const char *str, size_t &id, size_t max) { + if (str == nullptr) + return _error->Error(_("Incorrect usage, no ID was given.")); try { id = std::stoi(str); diff --git a/test/integration/test-history b/test/integration/test-history index e10dab08e..34108e357 100755 --- a/test/integration/test-history +++ b/test/integration/test-history @@ -128,3 +128,7 @@ End time: dummy Requested by: Command line: install nothing Packages changed:" normalizedinfo + +testfailureequal "E: Incorrect usage, no ID was given." apt history-redo +testfailureequal "E: Incorrect usage, no ID was given." apt history-undo +testfailureequal "E: Incorrect usage, no ID was given." apt history-rollback |
