2
Vote

NullReferenceException when FileDB.Store() with FileAccess.Read

description

Take a look at this:
 
public ActionResult Index()
{
var basePath = Path.Combine(HttpRuntime.AppDomainAppPath, "App_Data");
var db = new FileDB(Path.Combine(basePath, "test.fdb"), System.IO.FileAccess.Read);
 
var memStr = new MemoryStream();
var sR = new StreamWriter(memStr);
sR.WriteLine("Let's test this buddy!");
sR.Flush();
memStr.Position = 0;
 
db.Store("test1", memStr);
//NullReferenceException -> should be e.g. InvalidFileAccessModeException
 
ViewBag.Message = "Welcome to ASP.NET MVC!";
return View();
}

comments

mbdavid wrote Feb 10, 2011 at 10:55 PM

You right tibel. I'm putting a check in Engine.Write / Engine.Delete. I will publish a new release with few improves and unit tests.
Thanks for contribute!

mbdavid wrote Feb 10, 2011 at 10:58 PM

Sory jakub, I didn't see your name as a repor author. Thanks!

wrote Feb 14, 2013 at 3:02 AM