summaryrefslogtreecommitdiffstats
path: root/src/Array.cpp
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2019-05-19 00:27:43 +0200
committerGravatar Nikias Bassen2019-05-19 00:27:43 +0200
commit23e5a7636bba1565d000adcd4c3debc0788398c5 (patch)
tree4b3d51f3e0cfd34a3ea0b21ac87bfc788e3f0022 /src/Array.cpp
parent08c6143b870167ad29f9c20a298e0f75c986d0ea (diff)
downloadlibplist-23e5a7636bba1565d000adcd4c3debc0788398c5.tar.gz
libplist-23e5a7636bba1565d000adcd4c3debc0788398c5.tar.bz2
plist_array_get_item_index(): return UINT_MAX instead of 0 when node can't be found
Diffstat (limited to 'src/Array.cpp')
-rw-r--r--src/Array.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Array.cpp b/src/Array.cpp
index a511841..d5d9d7c 100644
--- a/src/Array.cpp
+++ b/src/Array.cpp
@@ -22,6 +22,7 @@
#include <plist/Array.h>
#include <algorithm>
+#include <limits.h>
namespace PList
{
@@ -118,6 +119,9 @@ void Array::Remove(Node* node)
if (node)
{
uint32_t pos = plist_array_get_item_index(node->GetPlist());
+ if (pos == UINT_MAX) {
+ return;
+ }
plist_array_remove_item(_node, pos);
std::vector<Node*>::iterator it = _array.begin();
it += pos;