Kids need to learn that things have edges and that you fall down when you crawl or toddle over them. We had our kids often on a futon on a carpet. Maybe an 8" fall. That was perfect for learning what happens if you go over the edge and what to do about this. As a result they were all very early "staircase" safe and knew what to do when approaching an edge.
Barriers prevent this learning from happening. I'm friends with a brain surgeon at Boston's Children hospital. According to him one of the main causes for serious brain injury are barriers at the top of the stairs. Kids climb eventually over them and the resulting fall is typically head first much much worse than simply falling down the stairs as is.
In your case it really depends on what a fall may look like. If it's a 4 foot fall on stone tiles, you need prevent it with all possible means. If it's only two feet and there is only one spot where the youngster could escape, I would consider putting a thick pillow or elevated cushion there. In any case, I would make sure that there is some opportunity for safe falling so that the kid can learn the properly handle that.