diff options
-rw-r--r-- | lldb/source/Commands/CommandObjectTarget.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 24a6b9dcadb..024f7b5a041 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -545,9 +545,16 @@ protected: } else { - result.AppendErrorWithFormat ("index %u is out of range, valid target indexes are 0 - %u\n", - target_idx, - num_targets - 1); + if (num_targets > 0) + { + result.AppendErrorWithFormat ("index %u is out of range, valid target indexes are 0 - %u\n", + target_idx, + num_targets - 1); + } else + { + result.AppendErrorWithFormat ("index %u is out of range since there are no active targets\n", + target_idx); + } result.SetStatus (eReturnStatusFailed); } } |