Skip to content

Commit

Permalink
fixed crash when DONE cmd is not last one
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Li <Frank.Li@nxp.com>
  • Loading branch information
nxpfrankli committed Jan 25, 2019
1 parent c83c28e commit a1a8e69
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions libuuu/cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ int CmdList::run_all(CmdCtx *p, bool dry_run)
call_notify(nt);
if (ret)
return ret;

if ((*it)->m_lastcmd)
break;
}
}
return ret;
Expand Down
5 changes: 3 additions & 2 deletions libuuu/cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ class CmdBase
public:
vector<Param> m_param;
uint64_t m_timeout;
bool m_lastcmd;
std::string m_cmd;
CmdBase() { m_timeout = 2000; };
CmdBase() { m_timeout = 2000; m_lastcmd = false; };
CmdBase(char *p) { m_timeout = 2000; if (p) m_cmd = p; }
void insert_param_info(const char *key, void *pD, Param::Param_Type tp, bool ignore_case = true)
{
Expand Down Expand Up @@ -148,7 +149,7 @@ class CmdObjCreateMap:public map<string, CreateCmdObj>
class CmdDone :public CmdBase
{
public:
CmdDone(char *p) :CmdBase(p) {};
CmdDone(char *p) :CmdBase(p) { m_lastcmd = true; };
int run(CmdCtx *p);
};

Expand Down

0 comments on commit a1a8e69

Please sign in to comment.