Commits

blipi  committed f1bd94a

v0.6.2
Fixed error on returning buffer when len = 0
Fixed error on opening for +2nd time the osk within the same class

  • Participants
  • Parent commits 029d020

Comments (0)

Files changed (2)

File oskdialog.cpp

 	return 0;
 }
 
+u8 OSK::open(){
+	memset(this->buffer, 0, 256); 
+	this->cursor_pos = 0;
+	this->mode = 1;
+	this->sel_row = 0;
+	this->sel_num = 0;
+
+	this->status = OSK_RUNNING;
+
+	return 0; 
+}
+
 char *OSK::getBuffer(){ 
 	this->status = OSK_END; 
 
-	char *buf = (char*)malloc(strlen(this->buffer));
+	int len = strlen(this->buffer);
+
+	if(len <= 0)
+		return NULL;
+
+	char *buf = (char*)malloc(len);
 	strcpy(buf, this->buffer);
 
 	return buf;
 	u8 draw();
 	u8 handlePad();
 
-	u8 open(){ status = OSK_RUNNING; memset(buffer, 0, 256); return 0; };
+	u8 open();
 
 	u32 *getTexturePointer(){ return this->texture_pointer; };
 	osk_status getStatus(){ return this->status; };