Fix various null pointer exceptions caused by flows with an empty match
Add unit tests where possible

Change-Id: I893d47dd92daf3fd8d9a2155dc6a6bf32949f7dc
Signed-off-by: Rob Adams <readams@readams.net>