It's her human side kicking in. She's not very smart at the moment, but she will snap out of when she Gandalf is about to chew her out when this scene is over. She thinks that her life doesn't matter as much as the others so she's taking dumb risks trying to protect others. Gandalf is about to chew her out for this and remind her who she is and how important she is. Don't worry, I planned for her to be like this. She won't be like this much longer.