From 468aa4462224a722b334d7140723b169556ba368 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Mon, 21 Jun 2021 20:37:13 +0800 Subject: [PATCH] updated Map.cpp --- inc/hgl/type/Map.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/inc/hgl/type/Map.cpp b/inc/hgl/type/Map.cpp index a7a25ad..54ba321 100644 --- a/inc/hgl/type/Map.cpp +++ b/inc/hgl/type/Map.cpp @@ -224,8 +224,11 @@ namespace hgl bool _Map::GetBySerial(int index,K &f,V &t) const { if(index<0||index>=data_list.GetCount())return(false); + + DataPair *ds; - DataPair *ds=data_list[index]; + if(!data_list.Get(index,ds)) + return(false); f=ds->left; t=ds->right; @@ -243,8 +246,11 @@ namespace hgl bool _Map::GetKey(int index,K &f) { if(index<0||index>=data_list.GetCount())return(false); + + DataPair *ds; - DataPair *ds=data_list[index]; + if(!data_list.Get(index,ds)) + return(false); f=ds->left; @@ -261,10 +267,11 @@ namespace hgl bool _Map::GetValue(int index,V &t) { if(index<0||index>=data_list.GetCount())return(false); + + DataPair *ds; - DataPair *ds=data_list[index]; - - if(!ds)return(false); + if(!data_list.Get(index,ds)) + return(false); t=ds->right;